mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge the last PGO-green inbound changeset to m-c.
This commit is contained in:
commit
362bb93971
@ -111,7 +111,8 @@
|
||||
function getNestedDoc()
|
||||
{
|
||||
var iframeNodes = currentTabDocument().getElementsByTagName("iframe");
|
||||
return iframeNodes ? iframeNodes[0].firstChild : null;
|
||||
return iframeNodes && iframeNodes.length > 0 ?
|
||||
iframeNodes[0].firstChild : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,3 +576,7 @@ pref("browser.prompt.allowNative", false);
|
||||
// they are handled separately. This pref is only read once at startup:
|
||||
// a restart is required to enable a new value.
|
||||
pref("network.activity.blipIntervalMilliseconds", 250);
|
||||
|
||||
// Send some sites a custom user-agent.
|
||||
pref("general.useragent.override.facebook.com", "\(Mobile#(Android; Mobile");
|
||||
pref("general.useragent.override.youtube.com", "\(Mobile#(Android; Mobile");
|
||||
|
@ -24,6 +24,7 @@ Cu.import('resource://gre/modules/ObjectWrapper.jsm');
|
||||
Cu.import('resource://gre/modules/accessibility/AccessFu.jsm');
|
||||
Cu.import('resource://gre/modules/Payment.jsm');
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import('resource://gre/modules/UserAgentOverrides.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
|
||||
'@mozilla.org/process/environment;1',
|
||||
@ -178,6 +179,7 @@ var shell = {
|
||||
CustomEventManager.init();
|
||||
WebappsHelper.init();
|
||||
AccessFu.attach(window);
|
||||
UserAgentOverrides.init();
|
||||
|
||||
// XXX could factor out into a settings->pref map. Not worth it yet.
|
||||
SettingsListener.observe("debug.fps.enabled", false, function(value) {
|
||||
@ -213,6 +215,7 @@ var shell = {
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
delete Services.audioManager;
|
||||
#endif
|
||||
UserAgentOverrides.uninit();
|
||||
},
|
||||
|
||||
// If this key event actually represents a hardware button, filter it here
|
||||
|
@ -8,6 +8,8 @@ MOZ_APP_VENDOR=Mozilla
|
||||
MOZ_APP_VERSION=18.0a1
|
||||
MOZ_APP_UA_NAME=Firefox
|
||||
|
||||
MOZ_UA_OS_AGNOSTIC=1
|
||||
|
||||
MOZ_B2G_VERSION=1.0.0
|
||||
|
||||
MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
|
||||
|
@ -101,7 +101,7 @@ var stringBundle;
|
||||
// displays a download dialog (remove these 3 lines for silent download)
|
||||
let xfer = Components.classes["@mozilla.org/transfer;1"].
|
||||
createInstance(Components.interfaces.nsITransfer);
|
||||
xfer.init(source, target, "", null, null, null, persist);
|
||||
xfer.init(source, target, "", null, null, null, persist, false);
|
||||
persist.progressListener = xfer;
|
||||
|
||||
// save the canvas data to the file
|
||||
|
@ -617,7 +617,10 @@ var SocialToolbar = {
|
||||
let box = document.createElement("box");
|
||||
box.classList.add("toolbarbutton-1");
|
||||
box.setAttribute("id", iconId);
|
||||
box.addEventListener("mousedown", function (e) { SocialToolbar.showAmbientPopup(box); }, false);
|
||||
box.addEventListener("mousedown", function (e) {
|
||||
if (e.button == 0)
|
||||
SocialToolbar.showAmbientPopup(box);
|
||||
}, false);
|
||||
box.setAttribute("notificationFrameId", notificationFrameId);
|
||||
stack = document.createElement("stack");
|
||||
stack.setAttribute("id", stackId);
|
||||
|
@ -5313,7 +5313,7 @@ function handleLinkClick(event, href, linkNode) {
|
||||
|
||||
if (where == "save") {
|
||||
saveURL(href, linkNode ? gatherTextUnder(linkNode) : "", null, true,
|
||||
true, doc.documentURIObject);
|
||||
true, doc.documentURIObject, doc);
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
# 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/.
|
||||
|
||||
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
function nsContextMenu(aXulMenu, aBrowser, aIsShift) {
|
||||
this.shouldDisplay = true;
|
||||
this.initMenu(aBrowser, aXulMenu, aIsShift);
|
||||
@ -961,7 +963,7 @@ nsContextMenu.prototype = {
|
||||
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
||||
// do it the old fashioned way, which will pick the best filename
|
||||
// it can without waiting.
|
||||
saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject);
|
||||
saveURL(linkURL, linkText, dialogTitle, bypassCache, false, doc.documentURIObject, doc);
|
||||
}
|
||||
if (this.extListener)
|
||||
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
||||
@ -1006,6 +1008,10 @@ nsContextMenu.prototype = {
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var channel = ioService.newChannelFromURI(makeURI(linkURL));
|
||||
if (channel instanceof Ci.nsIPrivateBrowsingChannel) {
|
||||
let docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView);
|
||||
channel.setPrivate(docIsPrivate);
|
||||
}
|
||||
channel.notificationCallbacks = new callbacks();
|
||||
|
||||
let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
|
||||
|
@ -807,14 +807,14 @@ function saveMedia()
|
||||
else if (item instanceof HTMLAudioElement)
|
||||
titleKey = "SaveAudioTitle";
|
||||
|
||||
saveURL(url, null, titleKey, false, false, makeURI(item.baseURI));
|
||||
saveURL(url, null, titleKey, false, false, makeURI(item.baseURI), gDocument);
|
||||
}
|
||||
} else {
|
||||
selectSaveFolder(function(aDirectory) {
|
||||
if (aDirectory) {
|
||||
var saveAnImage = function(aURIString, aChosenData, aBaseURI) {
|
||||
internalSave(aURIString, null, null, null, null, false, "SaveImageTitle",
|
||||
aChosenData, aBaseURI);
|
||||
aChosenData, aBaseURI, gDocument);
|
||||
};
|
||||
|
||||
for (var i = 0; i < rowArray.length; i++) {
|
||||
|
@ -193,6 +193,9 @@ _BROWSER_FILES = \
|
||||
bug564387.html \
|
||||
bug564387_video1.ogv \
|
||||
bug564387_video1.ogv^headers^ \
|
||||
browser_save_link.js \
|
||||
bug792517-2.html \
|
||||
bug792517.sjs \
|
||||
browser_scope.js \
|
||||
browser_selectTabAtIndex.js \
|
||||
browser_tab_dragdrop.js \
|
||||
|
128
browser/base/content/test/browser_save_link.js
Normal file
128
browser/base/content/test/browser_save_link.js
Normal file
@ -0,0 +1,128 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init();
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
|
||||
let NetUtil = tempScope.NetUtil;
|
||||
|
||||
// Trigger a save of a link in public mode, then trigger an identical save
|
||||
// in private mode and ensure that the second request is differentiated from
|
||||
// the first by checking the cookies that are sent.
|
||||
|
||||
function triggerSave(aCallback) {
|
||||
var fileName;
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
let testBrowser = gBrowser.selectedBrowser;
|
||||
testBrowser.loadURI("http://mochi.test:8888/browser/browser/base/content/test/bug792517-2.html");
|
||||
testBrowser.addEventListener("pageshow", function pageShown(event) {
|
||||
if (event.target.location == "about:blank")
|
||||
return;
|
||||
testBrowser.removeEventListener("pageshow", pageShown, false);
|
||||
|
||||
executeSoon(function () {
|
||||
document.addEventListener("popupshown", contextMenuOpened, false);
|
||||
|
||||
var link = testBrowser.contentDocument.getElementById("fff");
|
||||
EventUtils.synthesizeMouseAtCenter(link,
|
||||
{ type: "contextmenu", button: 2 },
|
||||
testBrowser.contentWindow);
|
||||
});
|
||||
}, false);
|
||||
|
||||
function contextMenuOpened(event) {
|
||||
event.currentTarget.removeEventListener("popupshown", contextMenuOpened, false);
|
||||
|
||||
// Create the folder the link will be saved into.
|
||||
var destDir = createTemporarySaveDirectory();
|
||||
var destFile = destDir.clone();
|
||||
|
||||
MockFilePicker.displayDirectory = destDir;
|
||||
MockFilePicker.showCallback = function(fp) {
|
||||
fileName = fp.defaultString;
|
||||
destFile.append (fileName);
|
||||
MockFilePicker.returnFiles = [destFile];
|
||||
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
|
||||
};
|
||||
|
||||
mockTransferCallback = function(a) onTransferComplete(a, destFile, destDir);
|
||||
|
||||
// Select "Save Link As" option from context menu
|
||||
var saveLinkCommand = document.getElementById("context-savelink");
|
||||
saveLinkCommand.doCommand();
|
||||
|
||||
event.target.hidePopup();
|
||||
}
|
||||
|
||||
function onTransferComplete(downloadSuccess, destFile, destDir) {
|
||||
ok(downloadSuccess, "Link should have been downloaded successfully");
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
// Give the request a chance to finish
|
||||
executeSoon(function() aCallback(destFile, destDir));
|
||||
}
|
||||
}
|
||||
|
||||
function readFile(file, callback) {
|
||||
let channel = NetUtil.newChannel(file);
|
||||
channel.contentType = "application/javascript";
|
||||
|
||||
NetUtil.asyncFetch(channel, function(inputStream, status) {
|
||||
ok(Components.isSuccessCode(status),
|
||||
"file was read successfully");
|
||||
|
||||
let content = NetUtil.readInputStreamToString(inputStream,
|
||||
inputStream.available());
|
||||
executeSoon(function() callback(content));
|
||||
});
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"]
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
mockTransferRegisterer.register();
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
mockTransferRegisterer.unregister();
|
||||
MockFilePicker.cleanup();
|
||||
pb.privateBrowsingEnabled = false;
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
});
|
||||
|
||||
triggerSave(function(destFile, destDir) {
|
||||
readFile(destFile, function(content) {
|
||||
is(content, "cookie-not-present", "no cookie should be sent");
|
||||
destDir.remove(true);
|
||||
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
pb.privateBrowsingEnabled = true;
|
||||
triggerSave(function(destFile, destDir) {
|
||||
readFile(destFile, function(content) {
|
||||
is(content, "cookie-not-present", "no cookie should be sent");
|
||||
destDir.remove(true);
|
||||
finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
this);
|
||||
|
||||
function createTemporarySaveDirectory() {
|
||||
var saveDir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
saveDir.append("testsavedir");
|
||||
if (!saveDir.exists())
|
||||
saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
|
||||
return saveDir;
|
||||
}
|
5
browser/base/content/test/bug792517-2.html
Normal file
5
browser/base/content/test/bug792517-2.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<a href="bug792517.sjs" id="fff">this is a link</a>
|
||||
</body>
|
||||
</html>
|
13
browser/base/content/test/bug792517.sjs
Normal file
13
browser/base/content/test/bug792517.sjs
Normal file
@ -0,0 +1,13 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function handleRequest(aRequest, aResponse) {
|
||||
aResponse.setStatusLine(aRequest.httpVersion, 200);
|
||||
if (aRequest.hasHeader('Cookie')) {
|
||||
aResponse.write("cookie-present");
|
||||
} else {
|
||||
aResponse.setHeader("Set-Cookie", "foopy=1");
|
||||
aResponse.write("cookie-not-present");
|
||||
}
|
||||
}
|
@ -109,7 +109,8 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
|
||||
params = {
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
postData: aPostData,
|
||||
referrerURI: aReferrerURI
|
||||
referrerURI: aReferrerURI,
|
||||
initiatingDoc: event.target.ownerDocument
|
||||
};
|
||||
}
|
||||
|
||||
@ -224,9 +225,10 @@ function openLinkIn(url, where, params) {
|
||||
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
|
||||
// Currently, this parameter works only for where=="tab" or "current"
|
||||
var aIsUTF8 = params.isUTF8;
|
||||
var aInitiatingDoc = params.initiatingDoc;
|
||||
|
||||
if (where == "save") {
|
||||
saveURL(url, null, null, true, null, aReferrerURI);
|
||||
saveURL(url, null, null, true, null, aReferrerURI, aInitiatingDoc);
|
||||
return;
|
||||
}
|
||||
const Cc = Components.classes;
|
||||
|
@ -1425,13 +1425,13 @@ let PlacesControllerDragHelper = {
|
||||
if (ip.isTag && ip.orientation == Ci.nsITreeView.DROP_ON &&
|
||||
dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
|
||||
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
|
||||
dragged.uri.startsWith("place:")))
|
||||
(dragged.uri && dragged.uri.startsWith("place:")) ))
|
||||
return false;
|
||||
|
||||
// The following loop disallows the dropping of a folder on itself or
|
||||
// on any of its descendants.
|
||||
if (dragged.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER ||
|
||||
dragged.uri.startsWith("place:")) {
|
||||
(dragged.uri && dragged.uri.startsWith("place:")) ) {
|
||||
let parentId = ip.itemId;
|
||||
while (parentId != PlacesUtils.placesRootId) {
|
||||
if (dragged.concreteId == parentId || dragged.id == parentId)
|
||||
@ -1634,7 +1634,13 @@ function doGetPlacesControllerForCommand(aCommand)
|
||||
{
|
||||
// A context menu may be built for non-focusable views. Thus, we first try
|
||||
// to look for a view associated with document.popupNode
|
||||
let popupNode = document.popupNode;
|
||||
let popupNode;
|
||||
try {
|
||||
popupNode = document.popupNode;
|
||||
} catch (e) {
|
||||
// The document went away (bug 797307).
|
||||
return null;
|
||||
}
|
||||
if (popupNode) {
|
||||
let view = PlacesUIUtils.getViewForNode(popupNode);
|
||||
if (view && view._contextMenuShown)
|
||||
|
@ -29,6 +29,7 @@ function test() {
|
||||
|
||||
// Add a new download
|
||||
let [file, persist] = addDownload(dm, {
|
||||
isPrivate: window.gPrivateBrowsingUI.privateWindow,
|
||||
resultFileName: "pbtest-1",
|
||||
downloadName: "PB Test 1"
|
||||
});
|
||||
@ -51,6 +52,7 @@ function test() {
|
||||
|
||||
// Add a new download
|
||||
let [file2, persist2] = addDownload(dm, {
|
||||
isPrivate: window.gPrivateBrowsingUI.privateWindow,
|
||||
resultFileName: "pbtest-2",
|
||||
downloadName: "PB Test 2"
|
||||
});
|
||||
@ -98,6 +100,7 @@ function test() {
|
||||
* sourceURI: the download source URI
|
||||
* downloadName: the display name of the download
|
||||
* runBeforeStart: a function to run before starting the download
|
||||
* isPrivate: whether the download is private
|
||||
*/
|
||||
function addDownload(dm, aParams)
|
||||
{
|
||||
@ -128,7 +131,7 @@ function addDownload(dm, aParams)
|
||||
let dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
|
||||
createURI(aParams.sourceURI),
|
||||
createURI(aParams.targetFile), aParams.downloadName, null,
|
||||
Math.round(Date.now() * 1000), null, persist);
|
||||
Math.round(Date.now() * 1000), null, persist, aParams.isPrivate);
|
||||
|
||||
// This will throw if it isn't found, and that would mean test failure, so no
|
||||
// try catch block
|
||||
|
@ -48,12 +48,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_454908_sample.html \
|
||||
browser_456342.js \
|
||||
browser_456342_sample.xhtml \
|
||||
browser_459906.js \
|
||||
browser_459906_empty.html \
|
||||
browser_459906_sample.html \
|
||||
browser_461634.js \
|
||||
browser_461743.js \
|
||||
browser_461743_sample.html \
|
||||
browser_463205.js \
|
||||
browser_463205_helper.html \
|
||||
browser_463205_sample.html \
|
||||
@ -139,6 +134,12 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_739805.js \
|
||||
$(NULL)
|
||||
|
||||
$(warning browser_459906.js is disabled for intermittent failures. Bug 766044)
|
||||
# browser_459906_empty.html \
|
||||
# browser_459906_sample.html \
|
||||
$(warning browser_461743.js is disabled for intermittent failures. Bug 765389)
|
||||
# browser_461743_sample.html \
|
||||
|
||||
# Disabled on Windows for frequent intermittent failures
|
||||
ifneq ($(OS_ARCH), WINNT)
|
||||
MOCHITEST_FILES += \
|
||||
|
@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_leaktest.js \
|
||||
browser_dbg_createRemote.js \
|
||||
browser_dbg_createChrome.js \
|
||||
browser_dbg_debugger-tab-switch.js \
|
||||
browser_dbg_debugger-tab-switch-window.js \
|
||||
@ -74,6 +73,15 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
# Disabled on Windows for frequent intermittent failures
|
||||
ifneq ($(OS_ARCH), WINNT)
|
||||
MOCHITEST_BROWSER_TESTS += \
|
||||
browser_dbg_createRemote.js \
|
||||
$(NULL)
|
||||
else
|
||||
$(warning browser_dbg_createRemote.js is disabled on Windows for intermittent failures. Bug 753225)
|
||||
endif
|
||||
|
||||
MOCHITEST_BROWSER_PAGES = \
|
||||
browser_dbg_tab1.html \
|
||||
browser_dbg_tab2.html \
|
||||
|
@ -60,6 +60,8 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_tilt_visualizer.js \
|
||||
browser_tilt_zoom.js \
|
||||
$(NULL)
|
||||
else
|
||||
$(warning browser_tilt_* disabled on Linux for intermittent failures. Bug 759157 and friends)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -364,6 +364,7 @@ function checkIFrame(aFrame, data) {
|
||||
checkedCount++;
|
||||
if (checkedCount == checksTodo) {
|
||||
SpecialPowers.removePermission("browser", "http://example.org");
|
||||
SpecialPowers.removePermission("embed-apps", "http://example.org");
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
gTestRunner.next();
|
||||
@ -389,6 +390,7 @@ function runTest() {
|
||||
};
|
||||
iframe.addChild = function() {
|
||||
SpecialPowers.addPermission("browser", true, iframe.contentDocument);
|
||||
SpecialPowers.addPermission("embed-apps", true, iframe.contentDocument);
|
||||
|
||||
var childFrame = document.createElement('iframe');
|
||||
|
||||
|
@ -5083,7 +5083,7 @@ fi
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Build with the Android Java compositor
|
||||
dnl = Build with the Android compositor
|
||||
dnl ========================================================
|
||||
if test -n "$MOZ_ANDROID_OMTC"; then
|
||||
dnl Do this if defined in confvars.sh
|
||||
|
@ -1275,7 +1275,7 @@ nsContentSink::IsTimeToNotify()
|
||||
LL_I2L(interval, GetNotificationInterval());
|
||||
LL_SUB(diff, now, mLastNotificationTime);
|
||||
|
||||
if (LL_CMP(diff, >, interval)) {
|
||||
if (diff > interval) {
|
||||
mBackoffCount--;
|
||||
return true;
|
||||
}
|
||||
|
@ -6881,7 +6881,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
|
||||
}
|
||||
}
|
||||
|
||||
if (LL_IS_ZERO(modDate)) {
|
||||
if (modDate == 0) {
|
||||
// We got nothing from our attempt to ask nsIFileChannel and
|
||||
// nsIHttpChannel for the last modified time. Return the current
|
||||
// time.
|
||||
@ -6889,7 +6889,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
|
||||
}
|
||||
|
||||
mLastModified.Truncate();
|
||||
if (LL_NE(modDate, LL_ZERO)) {
|
||||
if (modDate != LL_ZERO) {
|
||||
PRExplodedTime prtime;
|
||||
PR_ExplodeTime(modDate, PR_LocalTimeParameters, &prtime);
|
||||
// "MM/DD/YYYY hh:mm:ss"
|
||||
|
@ -1487,22 +1487,22 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
mDocShell = do_CreateInstance("@mozilla.org/docshell;1");
|
||||
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
|
||||
|
||||
if (OwnerIsBrowserFrame() &&
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
NS_ERROR("Apps Service is not available!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
nsAutoString manifest;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest);
|
||||
GetOwnerAppManifestURL(manifest);
|
||||
if (!manifest.IsEmpty()) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
NS_ERROR("Apps Service is not available!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t appId;
|
||||
appsService->GetAppLocalIdByManifestURL(manifest, &appId);
|
||||
uint32_t appId;
|
||||
appsService->GetAppLocalIdByManifestURL(manifest, &appId);
|
||||
|
||||
mDocShell->SetAppId(appId);
|
||||
mDocShell->SetAppId(appId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mNetworkCreated) {
|
||||
@ -1981,10 +1981,9 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
isBrowserElement = true;
|
||||
|
||||
if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) {
|
||||
nsAutoString manifest;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest);
|
||||
|
||||
nsAutoString manifest;
|
||||
GetOwnerAppManifestURL(manifest);
|
||||
if (!manifest.IsEmpty()) {
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
NS_ERROR("Apps Service is not available!");
|
||||
|
@ -46,6 +46,8 @@ enum {
|
||||
// Make sure we have enough space for those bits
|
||||
PR_STATIC_ASSERT(NODE_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32);
|
||||
|
||||
#undef DATA_NODE_FLAG_BIT
|
||||
|
||||
class nsGenericDOMDataNode : public nsIContent
|
||||
{
|
||||
public:
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
// Interface headers
|
||||
#include "imgILoader.h"
|
||||
#include "imgLoader.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -477,14 +477,7 @@ URIEquals(nsIURI *a, nsIURI *b)
|
||||
static bool
|
||||
IsSupportedImage(const nsCString& aMimeType)
|
||||
{
|
||||
nsCOMPtr<imgILoader> loader = nsContentUtils::GetImgLoaderForChannel(nullptr);
|
||||
if (!loader) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool supported;
|
||||
nsresult rv = loader->SupportImageWithMimeType(aMimeType.get(), &supported);
|
||||
return NS_SUCCEEDED(rv) && supported;
|
||||
return imgLoader::SupportImageWithMimeType(aMimeType.get());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "mozilla/SSE.h"
|
||||
#include "nsTextFragmentImpl.h"
|
||||
|
||||
#define TEXTFRAG_WHITE_AFTER_NEWLINE 50
|
||||
#define TEXTFRAG_MAX_NEWLINES 7
|
||||
@ -117,18 +118,10 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
|
||||
static inline int32_t
|
||||
FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
|
||||
{
|
||||
#if PR_BYTES_PER_WORD == 4
|
||||
const size_t mask = 0xff00ff00;
|
||||
const uint32_t alignMask = 0x3;
|
||||
const uint32_t numUnicharsPerWord = 2;
|
||||
#elif PR_BYTES_PER_WORD == 8
|
||||
const size_t mask = 0xff00ff00ff00ff00;
|
||||
const uint32_t alignMask = 0x7;
|
||||
const uint32_t numUnicharsPerWord = 4;
|
||||
#else
|
||||
#error Unknown platform!
|
||||
#endif
|
||||
|
||||
typedef Non8BitParameters<sizeof(size_t)> p;
|
||||
const size_t mask = p::mask();
|
||||
const uint32_t alignMask = p::alignMask();
|
||||
const uint32_t numUnicharsPerWord = p::numUnicharsPerWord();
|
||||
const int32_t len = end - str;
|
||||
int32_t i = 0;
|
||||
|
||||
|
24
content/base/src/nsTextFragmentImpl.h
Normal file
24
content/base/src/nsTextFragmentImpl.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsTextFragmentImpl_h__
|
||||
#define nsTextFragmentImpl_h__
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
template<size_t size> struct Non8BitParameters;
|
||||
template<> struct Non8BitParameters<4> {
|
||||
static inline size_t mask() { return 0xff00ff00; }
|
||||
static inline uint32_t alignMask() { return 0x3; }
|
||||
static inline uint32_t numUnicharsPerWord() { return 2; }
|
||||
};
|
||||
|
||||
template<> struct Non8BitParameters<8> {
|
||||
static inline size_t mask() { return 0xff00ff00ff00ff00; }
|
||||
static inline uint32_t alignMask() { return 0x7; }
|
||||
static inline uint32_t numUnicharsPerWord() { return 4; }
|
||||
};
|
||||
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
#include <emmintrin.h>
|
||||
#include "nscore.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsTextFragmentImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace SSE2 {
|
||||
@ -23,17 +24,9 @@ int32_t
|
||||
FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
|
||||
{
|
||||
const uint32_t numUnicharsPerVector = 8;
|
||||
|
||||
#if PR_BYTES_PER_WORD == 4
|
||||
const size_t mask = 0xff00ff00;
|
||||
const uint32_t numUnicharsPerWord = 2;
|
||||
#elif PR_BYTES_PER_WORD == 8
|
||||
const size_t mask = 0xff00ff00ff00ff00;
|
||||
const uint32_t numUnicharsPerWord = 4;
|
||||
#else
|
||||
#error Unknown platform!
|
||||
#endif
|
||||
|
||||
typedef Non8BitParameters<sizeof(size_t)> p;
|
||||
const size_t mask = p::mask();
|
||||
const uint32_t numUnicharsPerWord = p::numUnicharsPerWord();
|
||||
const int32_t len = end - str;
|
||||
int32_t i = 0;
|
||||
|
||||
|
@ -12,6 +12,13 @@ try {
|
||||
inWorker = true;
|
||||
}
|
||||
|
||||
function message(data) {
|
||||
if (inWorker)
|
||||
self.postMessage(data);
|
||||
else
|
||||
self.postMessage(data, "*");
|
||||
}
|
||||
|
||||
function is(got, expected, msg) {
|
||||
var obj = {};
|
||||
obj.type = "is";
|
||||
@ -19,7 +26,7 @@ function is(got, expected, msg) {
|
||||
obj.expected = expected;
|
||||
obj.msg = msg;
|
||||
|
||||
self.postMessage(obj, "*");
|
||||
message(obj);
|
||||
}
|
||||
|
||||
function ok(bool, msg) {
|
||||
@ -28,7 +35,7 @@ function ok(bool, msg) {
|
||||
obj.bool = bool;
|
||||
obj.msg = msg;
|
||||
|
||||
self.postMessage(obj, "*");
|
||||
message(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +330,7 @@ var TestCounter = {
|
||||
test.startXHR();
|
||||
}
|
||||
else {
|
||||
self.postMessage("done", "*");
|
||||
message("done");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -111,6 +111,7 @@ function setUp() {
|
||||
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ function setUp() {
|
||||
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||
|
||||
let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
|
||||
SpecialPowers.addPermission("foobar", true, { url: APP_URL,
|
||||
|
@ -21,6 +21,7 @@ EXPORTS = \
|
||||
CustomQS_Canvas2D.h \
|
||||
WebGLContext.h \
|
||||
WebGLElementArrayCache.h \
|
||||
WebGLExtensions.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
@ -47,15 +48,17 @@ CPPSRCS += \
|
||||
WebGLContextUtils.cpp \
|
||||
WebGLContextReporter.cpp \
|
||||
WebGLContextValidate.cpp \
|
||||
WebGLExtensionStandardDerivatives.cpp \
|
||||
WebGLExtensionTextureFilterAnisotropic.cpp \
|
||||
WebGLExtensionLoseContext.cpp \
|
||||
WebGLTexelConversions.cpp \
|
||||
WebGLExtensionCompressedTextureS3TC.cpp \
|
||||
WebGLElementArrayCache.cpp \
|
||||
WebGLExtensionBase.cpp \
|
||||
WebGLExtensionCompressedTextureATC.cpp \
|
||||
WebGLExtensionCompressedTexturePVRTC.cpp \
|
||||
WebGLExtensionCompressedTextureS3TC.cpp \
|
||||
WebGLExtensionDepthTexture.cpp \
|
||||
WebGLElementArrayCache.cpp \
|
||||
WebGLExtensionLoseContext.cpp \
|
||||
WebGLExtensionStandardDerivatives.cpp \
|
||||
WebGLExtensionTextureFilterAnisotropic.cpp \
|
||||
WebGLExtensionTextureFloat.cpp \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DUSE_ANGLE
|
||||
|
@ -41,11 +41,13 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gl;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
|
||||
@ -89,7 +91,6 @@ WebGLContext::WebGLContext()
|
||||
: gl(nullptr)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
mExtensions.SetLength(WebGLExtensionID_number_of_extensions);
|
||||
|
||||
mGeneration = 0;
|
||||
mInvalidated = false;
|
||||
@ -914,6 +915,11 @@ WebGLContext::GetContextAttributes(ErrorResult &rv)
|
||||
return obj;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::IsExtensionEnabled(WebGLExtensionID ext) const {
|
||||
return mExtensions.SafeElementAt(ext);
|
||||
}
|
||||
|
||||
/* [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname); */
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval)
|
||||
@ -943,161 +949,166 @@ WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext)
|
||||
bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
{
|
||||
bool isSupported = false;
|
||||
if (mDisableExtensions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (ext) {
|
||||
case OES_standard_derivatives:
|
||||
case WEBGL_lose_context:
|
||||
// We always support these extensions.
|
||||
isSupported = true;
|
||||
break;
|
||||
return true;
|
||||
case OES_texture_float:
|
||||
isSupported = gl->IsExtensionSupported(gl->IsGLES2() ? GLContext::OES_texture_float
|
||||
: GLContext::ARB_texture_float);
|
||||
break;
|
||||
return gl->IsExtensionSupported(gl->IsGLES2() ? GLContext::OES_texture_float
|
||||
: GLContext::ARB_texture_float);
|
||||
case EXT_texture_filter_anisotropic:
|
||||
isSupported = gl->IsExtensionSupported(GLContext::EXT_texture_filter_anisotropic);
|
||||
break;
|
||||
return gl->IsExtensionSupported(GLContext::EXT_texture_filter_anisotropic);
|
||||
case WEBGL_compressed_texture_s3tc:
|
||||
if (gl->IsExtensionSupported(GLContext::EXT_texture_compression_s3tc)) {
|
||||
isSupported = true;
|
||||
} else if (gl->IsExtensionSupported(GLContext::EXT_texture_compression_dxt1) &&
|
||||
return true;
|
||||
}
|
||||
else if (gl->IsExtensionSupported(GLContext::EXT_texture_compression_dxt1) &&
|
||||
gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt3) &&
|
||||
gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt5))
|
||||
{
|
||||
isSupported = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case WEBGL_compressed_texture_atc:
|
||||
if (gl->IsExtensionSupported(GLContext::AMD_compressed_ATC_texture)) {
|
||||
isSupported = true;
|
||||
}
|
||||
break;
|
||||
return gl->IsExtensionSupported(GLContext::AMD_compressed_ATC_texture);
|
||||
case WEBGL_compressed_texture_pvrtc:
|
||||
if (gl->IsExtensionSupported(GLContext::IMG_texture_compression_pvrtc)) {
|
||||
isSupported = true;
|
||||
}
|
||||
break;
|
||||
return gl->IsExtensionSupported(GLContext::IMG_texture_compression_pvrtc);
|
||||
case WEBGL_depth_texture:
|
||||
if (gl->IsGLES2() &&
|
||||
gl->IsExtensionSupported(GLContext::OES_packed_depth_stencil) &&
|
||||
gl->IsExtensionSupported(GLContext::OES_depth_texture))
|
||||
{
|
||||
isSupported = true;
|
||||
} else if (!gl->IsGLES2() &&
|
||||
gl->IsExtensionSupported(GLContext::EXT_packed_depth_stencil))
|
||||
{
|
||||
isSupported = true;
|
||||
return true;
|
||||
}
|
||||
else if (!gl->IsGLES2() &&
|
||||
gl->IsExtensionSupported(GLContext::EXT_packed_depth_stencil))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIWebGLExtension*
|
||||
WebGLContext::GetExtension(const nsAString& aName)
|
||||
static bool
|
||||
CompareWebGLExtensionName(const nsACString& name, const char *other)
|
||||
{
|
||||
return name.Equals(other, nsCaseInsensitiveCStringComparator());
|
||||
}
|
||||
|
||||
JSObject*
|
||||
WebGLContext::GetExtension(JSContext *cx, const nsAString& aName)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return nullptr;
|
||||
|
||||
if (mDisableExtensions) {
|
||||
return nullptr;
|
||||
}
|
||||
NS_LossyConvertUTF16toASCII name(aName);
|
||||
|
||||
WebGLExtensionID ext = WebGLExtensionID_unknown_extension;
|
||||
|
||||
if (aName.Equals(NS_LITERAL_STRING("OES_texture_float"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
// step 1: figure what extension is wanted
|
||||
if (CompareWebGLExtensionName(name, "OES_texture_float"))
|
||||
{
|
||||
if (IsExtensionSupported(OES_texture_float))
|
||||
ext = OES_texture_float;
|
||||
ext = OES_texture_float;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("OES_standard_derivatives"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "OES_standard_derivatives"))
|
||||
{
|
||||
if (IsExtensionSupported(OES_standard_derivatives))
|
||||
ext = OES_standard_derivatives;
|
||||
ext = OES_standard_derivatives;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "EXT_texture_filter_anisotropic"))
|
||||
{
|
||||
if (IsExtensionSupported(EXT_texture_filter_anisotropic))
|
||||
ext = EXT_texture_filter_anisotropic;
|
||||
ext = EXT_texture_filter_anisotropic;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_lose_context"))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_lose_context))
|
||||
ext = WEBGL_lose_context;
|
||||
ext = WEBGL_lose_context;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_compressed_texture_s3tc"))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
|
||||
ext = WEBGL_compressed_texture_s3tc;
|
||||
ext = WEBGL_compressed_texture_s3tc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_compressed_texture_atc"))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_atc))
|
||||
ext = WEBGL_compressed_texture_atc;
|
||||
ext = WEBGL_compressed_texture_atc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_pvrtc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_compressed_texture_pvrtc"))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_pvrtc))
|
||||
ext = WEBGL_compressed_texture_pvrtc;
|
||||
ext = WEBGL_compressed_texture_pvrtc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_depth_texture"))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_depth_texture))
|
||||
ext = WEBGL_depth_texture;
|
||||
ext = WEBGL_depth_texture;
|
||||
}
|
||||
|
||||
if (ext == WebGLExtensionID_unknown_extension) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mExtensions[ext]) {
|
||||
switch (ext) {
|
||||
case OES_standard_derivatives:
|
||||
mExtensions[ext] = new WebGLExtensionStandardDerivatives(this);
|
||||
break;
|
||||
case EXT_texture_filter_anisotropic:
|
||||
mExtensions[ext] = new WebGLExtensionTextureFilterAnisotropic(this);
|
||||
break;
|
||||
case WEBGL_lose_context:
|
||||
mExtensions[ext] = new WebGLExtensionLoseContext(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_s3tc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTextureS3TC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_atc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTextureATC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_pvrtc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTexturePVRTC(this);
|
||||
break;
|
||||
case WEBGL_depth_texture:
|
||||
mExtensions[ext] = new WebGLExtensionDepthTexture(this);
|
||||
break;
|
||||
default:
|
||||
// create a generic WebGLExtension object for any extensions that don't
|
||||
// have any additional tokens or methods. We still need these to be separate
|
||||
// objects in case the user might extend the corresponding JS objects with custom
|
||||
// properties.
|
||||
mExtensions[ext] = new WebGLExtension(this);
|
||||
break;
|
||||
}
|
||||
// step 2: check if the extension is supported
|
||||
if (!IsExtensionSupported(ext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mExtensions[ext];
|
||||
// step 3: if the extension hadn't been previously been created, create it now, thus enabling it
|
||||
if (!IsExtensionEnabled(ext)) {
|
||||
WebGLExtensionBase *obj = nullptr;
|
||||
switch (ext) {
|
||||
case OES_standard_derivatives:
|
||||
obj = new WebGLExtensionStandardDerivatives(this);
|
||||
break;
|
||||
case EXT_texture_filter_anisotropic:
|
||||
obj = new WebGLExtensionTextureFilterAnisotropic(this);
|
||||
break;
|
||||
case WEBGL_lose_context:
|
||||
obj = new WebGLExtensionLoseContext(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_s3tc:
|
||||
obj = new WebGLExtensionCompressedTextureS3TC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_atc:
|
||||
obj = new WebGLExtensionCompressedTextureATC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_pvrtc:
|
||||
obj = new WebGLExtensionCompressedTexturePVRTC(this);
|
||||
break;
|
||||
case WEBGL_depth_texture:
|
||||
obj = new WebGLExtensionDepthTexture(this);
|
||||
break;
|
||||
case OES_texture_float:
|
||||
obj = new WebGLExtensionTextureFloat(this);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
}
|
||||
mExtensions.EnsureLengthAtLeast(ext + 1);
|
||||
mExtensions[ext] = obj;
|
||||
}
|
||||
|
||||
// step 4: return the extension as a JS object
|
||||
JS::Value v;
|
||||
JSObject* wrapper = GetWrapper();
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
if (!WrapNewBindingObject(cx, wrapper, mExtensions[ext], &v)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &v.toObject();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1451,15 +1462,13 @@ NS_INTERFACE_MAP_BEGIN(WebGLRenderbuffer)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderbuffer)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
// WebGLUniformLocation
|
||||
|
||||
NS_IMPL_ADDREF(WebGLUniformLocation)
|
||||
NS_IMPL_RELEASE(WebGLUniformLocation)
|
||||
|
||||
DOMCI_DATA(WebGLUniformLocation, WebGLUniformLocation)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLUniformLocation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLUniformLocation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLUniformLocation)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
JSObject*
|
||||
@ -1468,16 +1477,22 @@ WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
|
||||
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
// WebGLShaderPrecisionFormat
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(WebGLShaderPrecisionFormat)
|
||||
NS_IMPL_RELEASE(WebGLShaderPrecisionFormat)
|
||||
|
||||
DOMCI_DATA(WebGLShaderPrecisionFormat, WebGLShaderPrecisionFormat)
|
||||
JSObject*
|
||||
WebGLShaderPrecisionFormat::WrapObject(JSContext *cx, JSObject *scope)
|
||||
{
|
||||
return dom::WebGLShaderPrecisionFormatBinding::Wrap(cx, scope, this);
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLShaderPrecisionFormat)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLShaderPrecisionFormat)
|
||||
NS_INTERFACE_MAP_END
|
||||
// WebGLActiveInfo
|
||||
|
||||
NS_IMPL_ADDREF(WebGLActiveInfo)
|
||||
NS_IMPL_RELEASE(WebGLActiveInfo)
|
||||
@ -1503,35 +1518,6 @@ NAME_NOT_SUPPORTED(WebGLShader)
|
||||
NAME_NOT_SUPPORTED(WebGLFramebuffer)
|
||||
NAME_NOT_SUPPORTED(WebGLRenderbuffer)
|
||||
|
||||
// WebGLExtension
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLExtension)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLExtension)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtension)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLExtension)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtension, WebGLExtension)
|
||||
|
||||
/* [noscript] attribute WebGLint location; */
|
||||
NS_IMETHODIMP
|
||||
WebGLUniformLocation::GetLocation(WebGLint *aLocation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLUniformLocation::SetLocation(WebGLint aLocation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLint size; */
|
||||
NS_IMETHODIMP
|
||||
WebGLActiveInfo::GetSize(WebGLint *aSize)
|
||||
@ -1556,40 +1542,12 @@ WebGLActiveInfo::GetName(nsAString & aName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLint rangeMin */
|
||||
NS_IMETHODIMP
|
||||
WebGLShaderPrecisionFormat::GetRangeMin(WebGLint *aRangeMin)
|
||||
{
|
||||
*aRangeMin = mRangeMin;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLint rangeMax */
|
||||
NS_IMETHODIMP
|
||||
WebGLShaderPrecisionFormat::GetRangeMax(WebGLint *aRangeMax)
|
||||
{
|
||||
*aRangeMax = mRangeMax;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLint precision */
|
||||
NS_IMETHODIMP
|
||||
WebGLShaderPrecisionFormat::GetPrecision(WebGLint *aPrecision)
|
||||
{
|
||||
*aPrecision = mPrecision;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
|
||||
{
|
||||
retval.SetNull();
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
|
||||
if (mDisableExtensions) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsString>& arr = retval.SetValue();
|
||||
|
||||
@ -1597,9 +1555,8 @@ WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
|
||||
arr.AppendElement(NS_LITERAL_STRING("OES_texture_float"));
|
||||
if (IsExtensionSupported(OES_standard_derivatives))
|
||||
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
|
||||
if (IsExtensionSupported(EXT_texture_filter_anisotropic)) {
|
||||
if (IsExtensionSupported(EXT_texture_filter_anisotropic))
|
||||
arr.AppendElement(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"));
|
||||
}
|
||||
if (IsExtensionSupported(WEBGL_lose_context))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
|
||||
|
@ -72,7 +72,6 @@ class WebGLShader;
|
||||
class WebGLFramebuffer;
|
||||
class WebGLRenderbuffer;
|
||||
class WebGLUniformLocation;
|
||||
class WebGLExtension;
|
||||
class WebGLContext;
|
||||
struct WebGLVertexAttribData;
|
||||
class WebGLMemoryPressureObserver;
|
||||
@ -80,6 +79,7 @@ class WebGLRectangleObject;
|
||||
class WebGLContextBoundObject;
|
||||
class WebGLActiveInfo;
|
||||
class WebGLShaderPrecisionFormat;
|
||||
class WebGLExtensionBase;
|
||||
|
||||
enum FakeBlackStatus { DoNotNeedFakeBlack, DoNeedFakeBlack, DontKnowIfNeedFakeBlack };
|
||||
|
||||
@ -631,7 +631,7 @@ public:
|
||||
JSObject *GetContextAttributes(ErrorResult &rv);
|
||||
bool IsContextLost() const { return !IsContextStable(); }
|
||||
void GetSupportedExtensions(dom::Nullable< nsTArray<nsString> > &retval);
|
||||
nsIWebGLExtension* GetExtension(const nsAString& aName);
|
||||
JSObject* GetExtension(JSContext* ctx, const nsAString& aName);
|
||||
void ActiveTexture(WebGLenum texture);
|
||||
void AttachShader(WebGLProgram* program, WebGLShader* shader);
|
||||
void BindAttribLocation(WebGLProgram* program, WebGLuint location,
|
||||
@ -1175,18 +1175,15 @@ protected:
|
||||
WEBGL_compressed_texture_atc,
|
||||
WEBGL_compressed_texture_pvrtc,
|
||||
WEBGL_depth_texture,
|
||||
WebGLExtensionID_number_of_extensions,
|
||||
WebGLExtensionID_unknown_extension
|
||||
};
|
||||
nsAutoTArray<nsRefPtr<WebGLExtension>, WebGLExtensionID_number_of_extensions> mExtensions;
|
||||
nsTArray<nsRefPtr<WebGLExtensionBase> > mExtensions;
|
||||
|
||||
// returns true if the extension has been enabled by calling getExtension.
|
||||
bool IsExtensionEnabled(WebGLExtensionID ext) {
|
||||
return mExtensions[ext];
|
||||
}
|
||||
bool IsExtensionEnabled(WebGLExtensionID ext) const;
|
||||
|
||||
// returns true if the extension is supported (as returned by getSupportedExtensions)
|
||||
bool IsExtensionSupported(WebGLExtensionID ext);
|
||||
bool IsExtensionSupported(WebGLExtensionID ext) const;
|
||||
|
||||
nsTArray<WebGLenum> mCompressedTextureFormats;
|
||||
|
||||
@ -1420,6 +1417,13 @@ public:
|
||||
friend class WebGLUniformLocation;
|
||||
};
|
||||
|
||||
// used by DOM bindings in conjunction with GetParentObject
|
||||
inline nsISupports*
|
||||
ToSupports(WebGLContext* context)
|
||||
{
|
||||
return static_cast<nsICanvasRenderingContextInternal*>(context);
|
||||
}
|
||||
|
||||
// This class is a mixin for objects that are tied to a specific
|
||||
// context (which is to say, all of them). They provide initialization
|
||||
// as well as comparison with the current context.
|
||||
@ -3000,7 +3004,7 @@ public:
|
||||
};
|
||||
|
||||
class WebGLUniformLocation MOZ_FINAL
|
||||
: public nsIWebGLUniformLocation
|
||||
: public nsISupports
|
||||
, public WebGLContextBoundObject
|
||||
{
|
||||
public:
|
||||
@ -3031,7 +3035,6 @@ public:
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLUNIFORMLOCATION
|
||||
protected:
|
||||
// nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted.
|
||||
// we just want to avoid having a dangling pointer.
|
||||
@ -3063,19 +3066,32 @@ protected:
|
||||
};
|
||||
|
||||
class WebGLShaderPrecisionFormat MOZ_FINAL
|
||||
: public nsIWebGLShaderPrecisionFormat
|
||||
: public nsISupports
|
||||
, public WebGLContextBoundObject
|
||||
{
|
||||
public:
|
||||
WebGLShaderPrecisionFormat(WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) :
|
||||
WebGLShaderPrecisionFormat(WebGLContext *context, WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) :
|
||||
WebGLContextBoundObject(context),
|
||||
mRangeMin(rangeMin),
|
||||
mRangeMax(rangeMax),
|
||||
mPrecision(precision)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLSHADERPRECISIONFORMAT
|
||||
|
||||
// WebIDL WebGLShaderPrecisionFormat API
|
||||
WebGLint RangeMin() const {
|
||||
return mRangeMin;
|
||||
}
|
||||
WebGLint RangeMax() const {
|
||||
return mRangeMax;
|
||||
}
|
||||
WebGLint Precision() const {
|
||||
return mPrecision;
|
||||
}
|
||||
|
||||
protected:
|
||||
WebGLint mRangeMin;
|
||||
@ -3083,23 +3099,6 @@ protected:
|
||||
WebGLint mPrecision;
|
||||
};
|
||||
|
||||
class WebGLExtension
|
||||
: public nsIWebGLExtension
|
||||
, public WebGLContextBoundObject
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
WebGLExtension(WebGLContext *baseContext)
|
||||
: WebGLContextBoundObject(baseContext)
|
||||
{}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLExtension)
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
|
||||
virtual ~WebGLExtension() {}
|
||||
};
|
||||
|
||||
inline const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() const {
|
||||
return mBoundFramebuffer ? mBoundFramebuffer->RectangleObject()
|
||||
: static_cast<const WebGLRectangleObject*>(this);
|
||||
|
@ -1723,7 +1723,7 @@ WebGLContext::GenerateMipmap(WebGLenum target)
|
||||
if (IsTextureFormatCompressed(format))
|
||||
return ErrorInvalidOperation("generateMipmap: Texture data at level zero is compressed.");
|
||||
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL))
|
||||
return ErrorInvalidOperation("generateMipmap: "
|
||||
"A texture that has a base internal format of "
|
||||
@ -2669,7 +2669,6 @@ WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname)
|
||||
return JS::DoubleValue(f);
|
||||
}
|
||||
|
||||
|
||||
ErrorInvalidEnumInfo("getTexParameter: parameter", pname);
|
||||
break;
|
||||
|
||||
@ -4491,7 +4490,7 @@ WebGLContext::GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precision
|
||||
gl->fGetShaderPrecisionFormat(shadertype, precisiontype, range, &precision);
|
||||
|
||||
WebGLShaderPrecisionFormat *retShaderPrecisionFormat
|
||||
= new WebGLShaderPrecisionFormat(range[0], range[1], precision);
|
||||
= new WebGLShaderPrecisionFormat(this, range[0], range[1], precision);
|
||||
NS_ADDREF(retShaderPrecisionFormat);
|
||||
return retShaderPrecisionFormat;
|
||||
}
|
||||
@ -4875,7 +4874,7 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
|
||||
return ErrorInvalidValue("texSubImage2D: with level > 0, width and height must be powers of two");
|
||||
}
|
||||
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL)) {
|
||||
return ErrorInvalidOperation("texSubImage2D: format");
|
||||
}
|
||||
|
29
content/canvas/src/WebGLExtensionBase.cpp
Normal file
29
content/canvas/src/WebGLExtensionBase.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionBase::WebGLExtensionBase(WebGLContext* context)
|
||||
: WebGLContextBoundObject(context)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
WebGLExtensionBase::~WebGLExtensionBase()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLExtensionBase)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLExtensionBase)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLExtensionBase)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLExtensionBase)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_ATC_RGB);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_ATC_RGBA_EXPLICIT_ALPHA);
|
||||
@ -17,16 +18,6 @@ WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLCont
|
||||
|
||||
WebGLExtensionCompressedTextureATC::~WebGLExtensionCompressedTextureATC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTextureATC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTextureATC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureATC, WebGLExtensionCompressedTextureATC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureATC)
|
||||
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1);
|
||||
@ -18,16 +19,6 @@ WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGL
|
||||
|
||||
WebGLExtensionCompressedTexturePVRTC::~WebGLExtensionCompressedTexturePVRTC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTexturePVRTC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTexturePVRTC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTexturePVRTC, WebGLExtensionCompressedTexturePVRTC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTexturePVRTC)
|
||||
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTextureS3TC::WebGLExtensionCompressedTextureS3TC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
|
||||
@ -18,16 +19,6 @@ WebGLExtensionCompressedTextureS3TC::WebGLExtensionCompressedTextureS3TC(WebGLCo
|
||||
|
||||
WebGLExtensionCompressedTextureS3TC::~WebGLExtensionCompressedTextureS3TC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTextureS3TC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTextureS3TC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureS3TC, WebGLExtensionCompressedTextureS3TC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureS3TC)
|
||||
|
@ -5,28 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionDepthTexture, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionDepthTexture, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionDepthTexture, WebGLExtensionDepthTexture)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDepthTexture)
|
||||
|
@ -5,45 +5,31 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionLoseContext::WebGLExtensionLoseContext(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionLoseContext::WebGLExtensionLoseContext(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionLoseContext::~WebGLExtensionLoseContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
WebGLExtensionLoseContext::LoseContext()
|
||||
{
|
||||
if (!mContext->LoseContext())
|
||||
mContext->mWebGLError = LOCAL_GL_INVALID_OPERATION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
WebGLExtensionLoseContext::RestoreContext()
|
||||
{
|
||||
if (!mContext->RestoreContext())
|
||||
mContext->mWebGLError = LOCAL_GL_INVALID_OPERATION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionLoseContext, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionLoseContext, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionLoseContext, WebGLExtensionLoseContext)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionLoseContext)
|
||||
|
@ -5,27 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionStandardDerivatives::WebGLExtensionStandardDerivatives(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionStandardDerivatives::WebGLExtensionStandardDerivatives(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionStandardDerivatives::~WebGLExtensionStandardDerivatives()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionStandardDerivatives, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionStandardDerivatives, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionStandardDerivatives, WebGLExtensionStandardDerivatives)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionStandardDerivatives)
|
||||
|
@ -5,27 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionTextureFilterAnisotropic::WebGLExtensionTextureFilterAnisotropic(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionTextureFilterAnisotropic::WebGLExtensionTextureFilterAnisotropic(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionTextureFilterAnisotropic::~WebGLExtensionTextureFilterAnisotropic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionTextureFilterAnisotropic, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionTextureFilterAnisotropic, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionTextureFilterAnisotropic, WebGLExtensionTextureFilterAnisotropic)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionTextureFilterAnisotropic)
|
||||
|
20
content/canvas/src/WebGLExtensionTextureFloat.cpp
Normal file
20
content/canvas/src/WebGLExtensionTextureFloat.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
}
|
||||
|
||||
WebGLExtensionTextureFloat::~WebGLExtensionTextureFloat()
|
||||
{
|
||||
}
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionTextureFloat)
|
@ -6,92 +6,119 @@
|
||||
#ifndef WEBGLEXTENSIONS_H_
|
||||
#define WEBGLEXTENSIONS_H_
|
||||
|
||||
#include "WebGLContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebGLExtensionLoseContext :
|
||||
public nsIWebGLExtensionLoseContext,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionBase
|
||||
: public nsISupports
|
||||
, public WebGLContextBoundObject
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
WebGLExtensionBase(WebGLContext*);
|
||||
virtual ~WebGLExtensionBase();
|
||||
|
||||
WebGLContext *GetParentObject() const {
|
||||
return Context();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLExtensionBase)
|
||||
};
|
||||
|
||||
#define DECL_WEBGL_EXTENSION_GOOP \
|
||||
JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
|
||||
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
||||
JSObject* \
|
||||
WebGLExtensionType::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { \
|
||||
return dom::WebGLExtensionType##Binding::Wrap(cx, scope, this, triedToWrap); \
|
||||
}
|
||||
|
||||
class WebGLExtensionCompressedTextureATC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureATC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTextureATC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTexturePVRTC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTexturePVRTC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureS3TC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureS3TC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTextureS3TC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionDepthTexture
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionDepthTexture(WebGLContext*);
|
||||
virtual ~WebGLExtensionDepthTexture();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionLoseContext
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionLoseContext(WebGLContext*);
|
||||
virtual ~WebGLExtensionLoseContext();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSIONLOSECONTEXT
|
||||
void LoseContext();
|
||||
void RestoreContext();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionStandardDerivatives :
|
||||
public nsIWebGLExtensionStandardDerivatives,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionStandardDerivatives
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionStandardDerivatives(WebGLContext* context);
|
||||
WebGLExtensionStandardDerivatives(WebGLContext*);
|
||||
virtual ~WebGLExtensionStandardDerivatives();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionTextureFilterAnisotropic :
|
||||
public nsIWebGLExtensionTextureFilterAnisotropic,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionTextureFilterAnisotropic
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionTextureFilterAnisotropic(WebGLContext* context);
|
||||
WebGLExtensionTextureFilterAnisotropic(WebGLContext*);
|
||||
virtual ~WebGLExtensionTextureFilterAnisotropic();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureS3TC :
|
||||
public nsIWebGLExtensionCompressedTextureS3TC,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionTextureFloat
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureS3TC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTextureS3TC();
|
||||
WebGLExtensionTextureFloat(WebGLContext*);
|
||||
virtual ~WebGLExtensionTextureFloat();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureATC :
|
||||
public nsIWebGLExtensionCompressedTextureATC,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureATC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTextureATC();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTexturePVRTC :
|
||||
public nsIWebGLExtensionCompressedTexturePVRTC,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTexturePVRTC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
class WebGLExtensionDepthTexture :
|
||||
public nsIWebGLExtensionDepthTexture,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionDepthTexture(WebGLContext* context);
|
||||
virtual ~WebGLExtensionDepthTexture();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // WEBGLEXTENSIONS_H_
|
||||
|
@ -325,8 +325,20 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// TODO: We surely need a permissions check here, particularly once we no
|
||||
// longer rely on the mozbrowser permission check.
|
||||
// Check permission.
|
||||
nsIPrincipal *principal = NodePrincipal();
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
NS_ENSURE_STATE(permMgr);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
nsresult rv = permMgr->TestPermissionFromPrincipal(principal,
|
||||
"embed-apps",
|
||||
&permission);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoString manifestURL;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifestURL);
|
||||
|
@ -694,9 +694,9 @@ nsXULTemplateQueryProcessorRDF::CompareResults(nsIXULTemplateResult* aLeft,
|
||||
int64_t delta;
|
||||
LL_SUB(delta, ldate, rdate);
|
||||
|
||||
if (LL_IS_ZERO(delta))
|
||||
if (delta == 0)
|
||||
*aResult = 0;
|
||||
else if (LL_GE_ZERO(delta))
|
||||
else if (delta >= 0)
|
||||
*aResult = 1;
|
||||
else
|
||||
*aResult = -1;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "imgLoader.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsWebNavigationInfo, nsIWebNavigationInfo)
|
||||
|
||||
@ -24,8 +25,6 @@ nsWebNavigationInfo::Init()
|
||||
mCategoryManager = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mImgLoader = nsContentUtils::GetImgLoaderForChannel(nullptr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -97,9 +96,10 @@ nsWebNavigationInfo::IsTypeSupportedInternal(const nsCString& aType,
|
||||
break;
|
||||
|
||||
case nsContentUtils::TYPE_CONTENT:
|
||||
bool isImage = false;
|
||||
mImgLoader->SupportImageWithMimeType(aType.get(), &isImage);
|
||||
if (isImage) {
|
||||
// XXXbz we only need this because images register for the same
|
||||
// contractid as documents, so we can't tell them apart based on
|
||||
// contractid.
|
||||
if (imgLoader::SupportImageWithMimeType(aType.get())) {
|
||||
*aIsSupported = nsIWebNavigationInfo::IMAGE;
|
||||
}
|
||||
else {
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "nsIWebNavigationInfo.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "imgILoader.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
@ -37,10 +36,6 @@ private:
|
||||
uint32_t* aIsSupported);
|
||||
|
||||
nsCOMPtr<nsICategoryManager> mCategoryManager;
|
||||
// XXXbz we only need this because images register for the same
|
||||
// contractid as documents, so we can't tell them apart based on
|
||||
// contractid.
|
||||
nsCOMPtr<imgILoader> mImgLoader;
|
||||
};
|
||||
|
||||
#endif // nsWebNavigationInfo_h__
|
||||
|
@ -284,13 +284,13 @@ nsSHistory::CalcMaxTotalViewers()
|
||||
// 4096 Mb 8
|
||||
uint64_t bytes = PR_GetPhysicalMemorySize();
|
||||
|
||||
if (LL_IS_ZERO(bytes))
|
||||
if (bytes == 0)
|
||||
return 0;
|
||||
|
||||
// Conversion from unsigned int64 to double doesn't work on all platforms.
|
||||
// We need to truncate the value at INT64_MAX to make sure we don't
|
||||
// overflow.
|
||||
if (LL_CMP(bytes, >, INT64_MAX))
|
||||
if (bytes > INT64_MAX)
|
||||
bytes = INT64_MAX;
|
||||
|
||||
uint64_t kbytes;
|
||||
|
@ -1567,37 +1567,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLRenderbuffer, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLUniformLocation,
|
||||
nsNewDOMBindingNoWrapperCacheSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLShaderPrecisionFormat, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLActiveInfo, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtension, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionStandardDerivatives, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionTextureFilterAnisotropic, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionLoseContext, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTextureS3TC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTextureATC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTexturePVRTC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionDepthTexture, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(PaintRequest, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -4260,50 +4231,10 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLRenderbuffer)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLShaderPrecisionFormat, nsIWebGLShaderPrecisionFormat)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLShaderPrecisionFormat)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLUniformLocation, nsIWebGLUniformLocation)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUniformLocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLActiveInfo, nsIWebGLActiveInfo)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLActiveInfo)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtension, nsIWebGLExtension)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtension)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionStandardDerivatives, nsIWebGLExtensionStandardDerivatives)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionStandardDerivatives)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionTextureFilterAnisotropic, nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionLoseContext, nsIWebGLExtensionLoseContext)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionLoseContext)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionCompressedTextureS3TC, nsIWebGLExtensionCompressedTextureS3TC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTextureS3TC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionCompressedTextureATC, nsIWebGLExtensionCompressedTextureATC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTextureATC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionCompressedTexturePVRTC, nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionDepthTexture, nsIWebGLExtensionDepthTexture)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionDepthTexture)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(PaintRequest, nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -10849,35 +10780,6 @@ nsSVGStringListSH::GetStringAt(nsISupports *aNative, int32_t aIndex,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLExtensionSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval)
|
||||
{
|
||||
WebGLExtensionSH::PreserveWrapper(GetNative(wrapper, obj));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLExtensionSH::PreserveWrapper(nsISupports *aNative)
|
||||
{
|
||||
WebGLExtension* ext = static_cast<WebGLExtension*>(aNative);
|
||||
nsContentUtils::PreserveWrapper(aNative, ext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
*parentObj = globalObj;
|
||||
|
||||
WebGLExtension *ext = static_cast<WebGLExtension*>(nativeObj);
|
||||
WebGLContext *webgl = ext->Context();
|
||||
nsINode *node = webgl->GetParentObject();
|
||||
|
||||
return WrapNativeParent(cx, globalObj, node, parentObj);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNewDOMBindingNoWrapperCacheSH::PreCreate(nsISupports *nativeObj,
|
||||
JSContext *cx,
|
||||
|
@ -481,32 +481,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// WebGLExtension scriptable helper
|
||||
|
||||
class WebGLExtensionSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
WebGLExtensionSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~WebGLExtensionSH()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
virtual void PreserveWrapper(nsISupports *aNative);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new WebGLExtensionSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
// scriptable helper for new-binding objects without wrapper caches
|
||||
|
||||
class nsNewDOMBindingNoWrapperCacheSH : public nsDOMGenericSH
|
||||
|
@ -453,17 +453,7 @@ DOMCI_CLASS(WebGLProgram)
|
||||
DOMCI_CLASS(WebGLShader)
|
||||
DOMCI_CLASS(WebGLFramebuffer)
|
||||
DOMCI_CLASS(WebGLRenderbuffer)
|
||||
DOMCI_CLASS(WebGLUniformLocation)
|
||||
DOMCI_CLASS(WebGLShaderPrecisionFormat)
|
||||
DOMCI_CLASS(WebGLActiveInfo)
|
||||
DOMCI_CLASS(WebGLExtension)
|
||||
DOMCI_CLASS(WebGLExtensionStandardDerivatives)
|
||||
DOMCI_CLASS(WebGLExtensionTextureFilterAnisotropic)
|
||||
DOMCI_CLASS(WebGLExtensionLoseContext)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTextureS3TC)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTextureATC)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTexturePVRTC)
|
||||
DOMCI_CLASS(WebGLExtensionDepthTexture)
|
||||
|
||||
DOMCI_CLASS(PaintRequest)
|
||||
DOMCI_CLASS(PaintRequestList)
|
||||
|
@ -3145,7 +3145,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
}
|
||||
}
|
||||
|
||||
if (sPostGCEventsToConsole || sPostGCEventsToObserver) {
|
||||
if (sPostGCEventsToObserver) {
|
||||
NS_NAMED_MULTILINE_LITERAL_STRING(kJSONFmt,
|
||||
NS_LL("{ \"timestamp\": %llu, ")
|
||||
NS_LL("\"duration\": %llu, ")
|
||||
@ -3506,7 +3506,7 @@ DOMGCSliceCallback(JSRuntime *aRt, js::GCProgress aProgress, const js::GCDescrip
|
||||
}
|
||||
}
|
||||
|
||||
if (sPostGCEventsToConsole || sPostGCEventsToObserver) {
|
||||
if (sPostGCEventsToObserver) {
|
||||
nsString json;
|
||||
json.Adopt(aDesc.formatJSON(aRt, PR_Now()));
|
||||
nsRefPtr<NotifyGCEndRunnable> notify = new NotifyGCEndRunnable(json);
|
||||
|
@ -51,7 +51,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
|
||||
|
||||
// Make sure that we serialize in the right context.
|
||||
JSAutoRequest ar(aCx);
|
||||
JSAutoCompartment ac(aCx, JS_GetGlobalObject(aCx));
|
||||
JSAutoCompartment ac(aCx, JS_GetGlobalObject(aCx));
|
||||
JS_WrapValue(aCx, &jsData);
|
||||
|
||||
nsCxPusher cxPusher;
|
||||
@ -59,7 +59,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
|
||||
|
||||
uint64_t* jsBytes = nullptr;
|
||||
bool success = JS_WriteStructuredClone(aCx, jsData, &jsBytes, &mSize,
|
||||
nullptr, nullptr);
|
||||
nullptr, nullptr, JSVAL_VOID);
|
||||
NS_ENSURE_STATE(success);
|
||||
NS_ENSURE_STATE(jsBytes);
|
||||
|
||||
@ -69,9 +69,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
|
||||
mSize = 0;
|
||||
mVersion = 0;
|
||||
|
||||
// FIXME This should really be js::Foreground::Free, but that's not public.
|
||||
JS_free(aCx, jsBytes);
|
||||
|
||||
JS_ClearStructuredClone(jsBytes, mSize);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else {
|
||||
@ -80,8 +78,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
|
||||
|
||||
memcpy(mData, jsBytes, mSize);
|
||||
|
||||
// FIXME Similarly, this should be js::Foreground::free.
|
||||
JS_free(aCx, jsBytes);
|
||||
JS_ClearStructuredClone(jsBytes, mSize);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -119,9 +116,14 @@ nsStructuredCloneContainer::DeserializeToVariant(JSContext *aCx,
|
||||
|
||||
// Deserialize to a jsval.
|
||||
jsval jsStateObj;
|
||||
JSBool hasTransferable;
|
||||
bool success = JS_ReadStructuredClone(aCx, mData, mSize, mVersion,
|
||||
&jsStateObj, nullptr, nullptr);
|
||||
NS_ENSURE_STATE(success);
|
||||
&jsStateObj, nullptr, nullptr) &&
|
||||
JS_StructuredCloneHasTransferables(mData, mSize,
|
||||
&hasTransferable);
|
||||
// We want to be sure that mData doesn't contain transferable objects
|
||||
MOZ_ASSERT(!hasTransferable);
|
||||
NS_ENSURE_STATE(success && !hasTransferable);
|
||||
|
||||
// Now wrap the jsval as an nsIVariant.
|
||||
nsCOMPtr<nsIVariant> varStateObj;
|
||||
|
@ -342,6 +342,46 @@ DOMInterfaces = {
|
||||
'headerFile': 'mozilla/dom/TextDecoder.h',
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTextureATC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTextureATC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTexturePVRTC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTexturePVRTC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTextureS3TC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTextureS3TC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionDepthTexture': {
|
||||
'nativeType': 'mozilla::WebGLExtensionDepthTexture',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionLoseContext': {
|
||||
'nativeType': 'mozilla::WebGLExtensionLoseContext',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionStandardDerivatives': {
|
||||
'nativeType': 'mozilla::WebGLExtensionStandardDerivatives',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionTextureFilterAnisotropic': {
|
||||
'nativeType': 'mozilla::WebGLExtensionTextureFilterAnisotropic',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionTextureFloat': {
|
||||
'nativeType': 'mozilla::WebGLExtensionTextureFloat',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLRenderingContext': {
|
||||
'nativeType': 'mozilla::WebGLContext',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
@ -350,6 +390,12 @@ DOMInterfaces = {
|
||||
'implicitJSContext': [ 'texImage2D', 'texSubImage2D' ],
|
||||
},
|
||||
|
||||
'WebGLShaderPrecisionFormat': {
|
||||
'nativeType': 'mozilla::WebGLShaderPrecisionFormat',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
'wrapperCache': False
|
||||
},
|
||||
|
||||
'WebGLUniformLocation': {
|
||||
'nativeType': 'mozilla::WebGLUniformLocation',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
@ -540,8 +586,6 @@ addExternalIface('WebGLBuffer', nativeType='mozilla::WebGLBuffer',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLContextAttributes', nativeType='JSObject',
|
||||
headerFile='jsapi.h')
|
||||
addExternalIface('WebGLExtension', nativeType='nsIWebGLExtension',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLFramebuffer', nativeType='mozilla::WebGLFramebuffer',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLProgram', nativeType='mozilla::WebGLProgram',
|
||||
@ -550,9 +594,6 @@ addExternalIface('WebGLRenderbuffer', nativeType='mozilla::WebGLRenderbuffer',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLShader', nativeType='mozilla::WebGLShader',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLShaderPrecisionFormat',
|
||||
nativeType='mozilla::WebGLShaderPrecisionFormat',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLTexture', nativeType='mozilla::WebGLTexture',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('Window')
|
||||
|
@ -115,13 +115,13 @@ MOCHITEST_FILES = \
|
||||
file_browserElement_SecurityChange.html \
|
||||
browserElement_BackForward.js \
|
||||
test_browserElement_inproc_BackForward.html \
|
||||
file_bug741717.sjs \
|
||||
file_bug741717.sjs \
|
||||
browserElement_Reload.js \
|
||||
file_bug709759.sjs \
|
||||
file_bug709759.sjs \
|
||||
browserElement_Stop.js \
|
||||
test_browserElement_inproc_Stop.html \
|
||||
browserElement_ContextmenuEvents.js \
|
||||
test_browserElement_inproc_ContextmenuEvents.html \
|
||||
test_browserElement_inproc_Stop.html \
|
||||
browserElement_ContextmenuEvents.js \
|
||||
test_browserElement_inproc_ContextmenuEvents.html \
|
||||
browserElement_SendEvent.js \
|
||||
test_browserElement_inproc_SendEvent.html \
|
||||
browserElement_ScrollEvent.js \
|
||||
@ -133,6 +133,9 @@ MOCHITEST_FILES = \
|
||||
test_browserElement_inproc_RemoveBrowserElement.html \
|
||||
browserElement_DOMRequestError.js \
|
||||
test_browserElement_inproc_DOMRequestError.html \
|
||||
file_browserElement_AppFramePermission.html \
|
||||
browserElement_AppFramePermission.js \
|
||||
test_browserElement_inproc_AppFramePermission.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
@ -187,12 +190,13 @@ MOCHITEST_FILES += \
|
||||
test_browserElement_oop_BackForward.html \
|
||||
test_browserElement_oop_Reload.html \
|
||||
test_browserElement_oop_Stop.html \
|
||||
test_browserElement_oop_ContextmenuEvents.html \
|
||||
test_browserElement_oop_ContextmenuEvents.html \
|
||||
test_browserElement_oop_SendEvent.html \
|
||||
test_browserElement_oop_ScrollEvent.html \
|
||||
test_browserElement_oop_Auth.html \
|
||||
test_browserElement_oop_RemoveBrowserElement.html \
|
||||
test_browserElement_oop_DOMRequestError.html \
|
||||
test_browserElement_oop_AppFramePermission.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
endif #}
|
||||
|
@ -0,0 +1,52 @@
|
||||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 777384 - Test mozapp permission.
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function makeAllAppsLaunchable() {
|
||||
var Webapps = {};
|
||||
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Webapps.jsm", Webapps);
|
||||
var appRegistry = SpecialPowers.wrap(Webapps.DOMApplicationRegistry);
|
||||
|
||||
var originalValue = appRegistry.allAppsLaunchable;
|
||||
appRegistry.allAppsLaunchable = true;
|
||||
|
||||
// Clean up after ourselves once tests are done so the test page is unloaded.
|
||||
window.addEventListener("unload", function restoreAllAppsLaunchable(event) {
|
||||
if (event.target == window.document) {
|
||||
window.removeEventListener("unload", restoreAllAppsLaunchable, false);
|
||||
appRegistry.allAppsLaunchable = originalValue;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
makeAllAppsLaunchable();
|
||||
|
||||
function testAppElement(expectAnApp, callback) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
is(e.detail.message == 'app', expectAnApp, e.detail.message);
|
||||
SimpleTest.executeSoon(callback);
|
||||
});
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AppFramePermission.html';
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
SpecialPowers.addPermission("embed-apps", true, document);
|
||||
testAppElement(true, function() {
|
||||
SpecialPowers.removePermission("embed-apps", document);
|
||||
testAppElement(false, function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
runTest();
|
@ -9,6 +9,8 @@ SimpleTest.waitForExplicitFinish();
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
// Permission to embed an app.
|
||||
SpecialPowers.addPermission("embed-apps", true, document);
|
||||
|
||||
var iframe1 = document.createElement('iframe');
|
||||
iframe1.mozbrowser = true;
|
||||
@ -29,6 +31,7 @@ function runTest() {
|
||||
|
||||
iframe2.addEventListener('mozbrowseropenwindow', function(e) {
|
||||
ok(true, "Got second mozbrowseropenwindow event.");
|
||||
SpecialPowers.removePermission("embed-apps", document);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
addEventListener('load', function(e) {
|
||||
navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
|
||||
if (this.result) {
|
||||
alert('app');
|
||||
} else {
|
||||
alert('notapp');
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 777384</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_AppFramePermission.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 777384</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_AppFramePermission.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
~ContinueHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -89,6 +89,8 @@ public:
|
||||
virtual nsresult GetSuccessResult(JSContext* aCx,
|
||||
jsval* aVal) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
PackArgumentsForParentProcess(CursorRequestParams& aParams) MOZ_OVERRIDE;
|
||||
|
||||
@ -370,7 +372,7 @@ IDBCursor::~IDBCursor()
|
||||
if (mRooted) {
|
||||
NS_DROP_JS_OBJECTS(this, IDBCursor);
|
||||
}
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -853,6 +855,13 @@ ContinueHelper::GetSuccessResult(JSContext* aCx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ContinueHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
CursorHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
||||
nsresult
|
||||
ContinueHelper::PackArgumentsForParentProcess(CursorRequestParams& aParams)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
|
||||
~GetHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -190,8 +190,7 @@ public:
|
||||
~GetAllHelper()
|
||||
{
|
||||
for (uint32_t index = 0; index < mCloneReadInfos.Length(); index++) {
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(
|
||||
mCloneReadInfos[index].mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfos[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +283,7 @@ public:
|
||||
|
||||
~OpenCursorHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -1215,7 +1214,7 @@ GetHelper::GetSuccessResult(JSContext* aCx,
|
||||
void
|
||||
GetHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
GetKeyHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
||||
@ -1556,8 +1555,7 @@ void
|
||||
GetAllHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
for (uint32_t index = 0; index < mCloneReadInfos.Length(); index++) {
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(
|
||||
mCloneReadInfos[index].mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfos[index]);
|
||||
}
|
||||
GetKeyHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
@ -2217,7 +2215,7 @@ OpenCursorHelper::EnsureCursor()
|
||||
void
|
||||
OpenCursorHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
|
||||
// These don't need to be released on the main thread but they're only valid
|
||||
// as long as mCursor is set.
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
|
||||
~AddHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneWriteInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneWriteInfo(mCloneWriteInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
~GetHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -278,7 +278,7 @@ public:
|
||||
|
||||
~OpenCursorHelper()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
}
|
||||
|
||||
virtual nsresult DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
@ -383,8 +383,7 @@ public:
|
||||
~GetAllHelper()
|
||||
{
|
||||
for (uint32_t index = 0; index < mCloneReadInfos.Length(); index++) {
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(
|
||||
mCloneReadInfos[index].mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfos[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -937,6 +936,42 @@ IDBObjectStore::GetStructuredCloneReadInfoFromStatement(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IDBObjectStore::ClearCloneWriteInfo(StructuredCloneWriteInfo& aWriteInfo)
|
||||
{
|
||||
// This is kind of tricky, we only want to release stuff on the main thread,
|
||||
// but we can end up being called on other threads if we have already been
|
||||
// cleared on the main thread.
|
||||
if (!aWriteInfo.mCloneBuffer.data() && !aWriteInfo.mFiles.Length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there's something to clear, we should be on the main thread.
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
ClearStructuredCloneBuffer(aWriteInfo.mCloneBuffer);
|
||||
aWriteInfo.mFiles.Clear();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IDBObjectStore::ClearCloneReadInfo(StructuredCloneReadInfo& aReadInfo)
|
||||
{
|
||||
// This is kind of tricky, we only want to release stuff on the main thread,
|
||||
// but we can end up being called on other threads if we have already been
|
||||
// cleared on the main thread.
|
||||
if (!aReadInfo.mCloneBuffer.data() && !aReadInfo.mFiles.Length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there's something to clear, we should be on the main thread.
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
ClearStructuredCloneBuffer(aReadInfo.mCloneBuffer);
|
||||
aReadInfo.mFiles.Clear();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer)
|
||||
@ -2738,7 +2773,7 @@ AddHelper::GetSuccessResult(JSContext* aCx,
|
||||
void
|
||||
AddHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneWriteInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneWriteInfo(mCloneWriteInfo);
|
||||
ObjectStoreHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
||||
@ -2891,7 +2926,7 @@ void
|
||||
GetHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
mKeyRange = nullptr;
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
ObjectStoreHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
||||
@ -3303,7 +3338,7 @@ void
|
||||
OpenCursorHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
mKeyRange = nullptr;
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(mCloneReadInfo.mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfo);
|
||||
|
||||
mCursor = nullptr;
|
||||
|
||||
@ -3754,8 +3789,7 @@ GetAllHelper::ReleaseMainThreadObjects()
|
||||
{
|
||||
mKeyRange = nullptr;
|
||||
for (uint32_t index = 0; index < mCloneReadInfos.Length(); index++) {
|
||||
IDBObjectStore::ClearStructuredCloneBuffer(
|
||||
mCloneReadInfos[index].mCloneBuffer);
|
||||
IDBObjectStore::ClearCloneReadInfo(mCloneReadInfos[index]);
|
||||
}
|
||||
ObjectStoreHelper::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
@ -83,7 +83,10 @@ public:
|
||||
StructuredCloneReadInfo& aInfo);
|
||||
|
||||
static void
|
||||
ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer);
|
||||
ClearCloneReadInfo(StructuredCloneReadInfo& aReadInfo);
|
||||
|
||||
static void
|
||||
ClearCloneWriteInfo(StructuredCloneWriteInfo& aWriteInfo);
|
||||
|
||||
static bool
|
||||
DeserializeValue(JSContext* aCx,
|
||||
@ -263,6 +266,9 @@ protected:
|
||||
bool aOverwrite,
|
||||
IDBRequest** _retval);
|
||||
|
||||
static void
|
||||
ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer);
|
||||
|
||||
private:
|
||||
nsRefPtr<IDBTransaction> mTransaction;
|
||||
|
||||
|
@ -95,20 +95,6 @@ interface nsIWebGLActiveInfo : nsISupports
|
||||
readonly attribute DOMString name;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(76265e93-2e8f-40ca-b25b-eea5995e9641)]
|
||||
interface nsIWebGLShaderPrecisionFormat : nsISupports
|
||||
{
|
||||
readonly attribute WebGLint rangeMin;
|
||||
readonly attribute WebGLint rangeMax;
|
||||
readonly attribute WebGLint precision;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
|
||||
interface nsIWebGLUniformLocation : nsISupports
|
||||
{
|
||||
[noscript] attribute WebGLint location;
|
||||
};
|
||||
|
||||
/* Base class for all WebGL extensions, and for those without
|
||||
* any additional tokens/methods.
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
bool
|
||||
ReadStructuredClone(JSContext* aCx, const uint64_t* aData, size_t aDataLength,
|
||||
ReadStructuredClone(JSContext* aCx, uint64_t* aData, size_t aDataLength,
|
||||
const StructuredCloneClosure& aClosure, JS::Value* aClone)
|
||||
{
|
||||
void* closure = &const_cast<StructuredCloneClosure&>(aClosure);
|
||||
|
@ -34,7 +34,7 @@ StructuredCloneData
|
||||
};
|
||||
|
||||
bool
|
||||
ReadStructuredClone(JSContext* aCx, const uint64_t* aData, size_t aDataLength,
|
||||
ReadStructuredClone(JSContext* aCx, uint64_t* aData, size_t aDataLength,
|
||||
const StructuredCloneClosure& aClosure, JS::Value* aClone);
|
||||
|
||||
inline bool
|
||||
|
@ -1983,13 +1983,13 @@ struct CompareFilesByTime
|
||||
bool
|
||||
LessThan(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const
|
||||
{
|
||||
return LL_CMP(GetPluginLastModifiedTime(a), <, GetPluginLastModifiedTime(b));
|
||||
return GetPluginLastModifiedTime(a) < GetPluginLastModifiedTime(b);
|
||||
}
|
||||
|
||||
bool
|
||||
Equals(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const
|
||||
{
|
||||
return LL_EQ(GetPluginLastModifiedTime(a), GetPluginLastModifiedTime(b));
|
||||
return GetPluginLastModifiedTime(a) == GetPluginLastModifiedTime(b);
|
||||
}
|
||||
};
|
||||
|
||||
@ -2063,7 +2063,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
if (pluginTag) {
|
||||
seenBefore = true;
|
||||
// If plugin changed, delete cachedPluginTag and don't use cache
|
||||
if (LL_NE(fileModTime, pluginTag->mLastModifiedTime)) {
|
||||
if (fileModTime != pluginTag->mLastModifiedTime) {
|
||||
// Plugins has changed. Don't use cached plugin info.
|
||||
enabled = (pluginTag->Flags() & NS_PLUGIN_FLAG_ENABLED) != 0;
|
||||
pluginTag = nullptr;
|
||||
@ -2194,7 +2194,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
|
||||
// Don't add the same plugin again if it hasn't changed
|
||||
if (nsPluginTag* duplicate = FirstPluginWithPath(pluginTag->mFullPath)) {
|
||||
if (LL_EQ(pluginTag->mLastModifiedTime, duplicate->mLastModifiedTime)) {
|
||||
if (pluginTag->mLastModifiedTime == duplicate->mLastModifiedTime) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -3692,7 +3692,7 @@ nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile)
|
||||
rv = inFile->GetNativePath(filename);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!LL_IS_ZERO(fileSize)) {
|
||||
if (fileSize != 0) {
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStream), inFile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -3760,7 +3760,7 @@ let RIL = {
|
||||
* Send messages to the main thread.
|
||||
*/
|
||||
sendDOMMessage: function sendDOMMessage(message) {
|
||||
postMessage(message, "*");
|
||||
postMessage(message);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@ try {
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||
|
||||
var gData = [
|
||||
// APP 1
|
||||
@ -107,6 +108,7 @@ function runTest()
|
||||
localStorage.clear();
|
||||
|
||||
SpecialPowers.removePermission("browser", window.document);
|
||||
SpecialPowers.removePermission("embed-apps", window.document);
|
||||
|
||||
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
||||
|
@ -193,28 +193,30 @@ function browserLoadEvent() {
|
||||
|
||||
frames[1].postMessage("clear", "http://www.example.com");
|
||||
|
||||
navigator.mozApps.mgmt.getAll().onsuccess = function() {
|
||||
for (i in this.result) {
|
||||
var app = this.result[i];
|
||||
if (app.manifestURL == gManifestURL) {
|
||||
is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
|
||||
is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
|
||||
SimpleTest.executeSoon(function() {
|
||||
navigator.mozApps.mgmt.getAll().onsuccess = function() {
|
||||
for (i in this.result) {
|
||||
var app = this.result[i];
|
||||
if (app.manifestURL == gManifestURL) {
|
||||
is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
|
||||
is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
|
||||
|
||||
is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
|
||||
|
||||
is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
|
||||
is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
|
||||
|
||||
Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
|
||||
Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
|
||||
|
||||
// Now we uninstall the app and make sure everything is clean.
|
||||
app.uninstall().onsuccess = function() {
|
||||
finish();
|
||||
};
|
||||
// Now we uninstall the app and make sure everything is clean.
|
||||
app.uninstall().onsuccess = function() {
|
||||
finish();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@ try {
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||
|
||||
var gData = [
|
||||
// APP 1
|
||||
@ -105,6 +106,7 @@ function runTest() {
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("browser", window.document);
|
||||
SpecialPowers.removePermission("embed-apps", window.document);
|
||||
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
|
@ -9,8 +9,6 @@
|
||||
* Copyright © 2012 Khronos Group
|
||||
*/
|
||||
|
||||
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
|
||||
//
|
||||
// WebGL IDL definitions scraped from the Khronos specification:
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/
|
||||
//
|
||||
@ -51,8 +49,6 @@ typedef float GLclampf;
|
||||
boolean preserveDrawingBuffer = false;
|
||||
};*/
|
||||
|
||||
interface WebGLExtension;
|
||||
|
||||
interface WebGLBuffer;
|
||||
|
||||
interface WebGLFramebuffer;
|
||||
@ -70,7 +66,11 @@ interface WebGLUniformLocation {
|
||||
|
||||
interface WebGLActiveInfo;
|
||||
|
||||
interface WebGLShaderPrecisionFormat;
|
||||
interface WebGLShaderPrecisionFormat {
|
||||
readonly attribute GLint rangeMin;
|
||||
readonly attribute GLint rangeMax;
|
||||
readonly attribute GLint precision;
|
||||
};
|
||||
|
||||
interface WebGLRenderingContext {
|
||||
|
||||
@ -496,12 +496,10 @@ interface WebGLRenderingContext {
|
||||
|
||||
[WebGLHandlesContextLoss, Throws] WebGLContextAttributes getContextAttributes();
|
||||
[WebGLHandlesContextLoss] boolean isContextLost();
|
||||
|
||||
|
||||
sequence<DOMString>? getSupportedExtensions();
|
||||
|
||||
// XXXbz In the spec, this is "object?"; I'm making it
|
||||
// WebGLExtension? just for ease of implementation.
|
||||
WebGLExtension? getExtension(DOMString name);
|
||||
object? getExtension(DOMString name);
|
||||
|
||||
void activeTexture(GLenum texture);
|
||||
void attachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
@ -602,7 +600,10 @@ interface WebGLRenderingContext {
|
||||
DOMString? getProgramInfoLog(WebGLProgram? program);
|
||||
any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
any getShaderParameter(WebGLShader? shader, GLenum pname);
|
||||
|
||||
[Creator]
|
||||
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
|
||||
DOMString? getShaderInfoLog(WebGLShader? shader);
|
||||
|
||||
DOMString? getShaderSource(WebGLShader? shader);
|
||||
@ -757,3 +758,53 @@ interface WebGLContextEvent : Event {
|
||||
/*dictionary WebGLContextEventInit : EventInit {
|
||||
DOMString statusMessage;
|
||||
};*/
|
||||
|
||||
|
||||
// specific extension interfaces
|
||||
|
||||
interface WebGLExtensionStandardDerivatives {
|
||||
const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
|
||||
};
|
||||
|
||||
interface WebGLExtensionLoseContext {
|
||||
void loseContext();
|
||||
void restoreContext();
|
||||
};
|
||||
|
||||
interface WebGLExtensionTextureFilterAnisotropic
|
||||
{
|
||||
const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
|
||||
const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTextureS3TC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTextureATC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_ATC_WEBGL = 0x8C92;
|
||||
const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93;
|
||||
const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTexturePVRTC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_PVRTC_4BPPV1 = 0x8C00;
|
||||
const GLenum COMPRESSED_RGB_PVRTC_2BPPV1 = 0x8C01;
|
||||
const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1 = 0x8C02;
|
||||
const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1 = 0x8C03;
|
||||
};
|
||||
|
||||
interface WebGLExtensionDepthTexture
|
||||
{
|
||||
const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
|
||||
};
|
||||
|
||||
interface WebGLExtensionTextureFloat
|
||||
{
|
||||
};
|
||||
|
@ -112,8 +112,6 @@ DOMWifiManager.prototype = {
|
||||
this._onConnectionInfoUpdate = null;
|
||||
this._onEnabled = null;
|
||||
this._onDisabled = null;
|
||||
|
||||
this._mm.sendAsyncMessage("WifiManager:managerFinished");
|
||||
},
|
||||
|
||||
_sendMessageForRequest: function(name, data, request) {
|
||||
|
@ -1369,6 +1369,7 @@ let WifiNetworkInterface = {
|
||||
|
||||
};
|
||||
|
||||
function WifiScanResult() {}
|
||||
|
||||
// TODO Make the difference between a DOM-based network object and our
|
||||
// networks objects much clearer.
|
||||
@ -1384,7 +1385,7 @@ function WifiWorker() {
|
||||
"WifiManager:associate", "WifiManager:forget",
|
||||
"WifiManager:wps", "WifiManager:getState",
|
||||
"WifiManager:setPowerSavingMode",
|
||||
"WifiManager:managerFinished"];
|
||||
"child-process-shutdown"];
|
||||
|
||||
messages.forEach((function(msgName) {
|
||||
this._mm.addMessageListener(msgName, this);
|
||||
@ -1995,15 +1996,10 @@ WifiWorker.prototype = {
|
||||
|
||||
_domManagers: [],
|
||||
_fireEvent: function(message, data) {
|
||||
// TODO (bug 791911): Managers don't correctly tell us when they're getting
|
||||
// destroyed, so prune dead managers here.
|
||||
this._domManagers = this._domManagers.filter(function(obj) {
|
||||
try {
|
||||
obj.manager.sendAsyncMessage("WifiManager:" + message, data);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
this._domManagers.forEach(function(manager) {
|
||||
// Note: We should never have a dead message manager here because we
|
||||
// observe our child message managers shutting down, below.
|
||||
manager.sendAsyncMessage("WifiManager:" + message, data);
|
||||
});
|
||||
},
|
||||
|
||||
@ -2013,9 +2009,25 @@ WifiWorker.prototype = {
|
||||
},
|
||||
|
||||
receiveMessage: function MessageManager_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json || {};
|
||||
let msg = aMessage.data || {};
|
||||
msg.manager = aMessage.target;
|
||||
|
||||
// Note: By the time we receive child-process-shutdown, the child process
|
||||
// has already forgotten its permissions so we do this before the
|
||||
// permissions check.
|
||||
if (aMessage.name === "child-process-shutdown") {
|
||||
let i;
|
||||
if ((i = this._domManagers.indexOf(msg.manager)) != -1) {
|
||||
this._domManagers.splice(i, 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aMessage.target.assertPermission("wifi-manage")) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "WifiManager:getNetworks":
|
||||
this.getNetworks(msg);
|
||||
@ -2036,39 +2048,18 @@ WifiWorker.prototype = {
|
||||
this.setPowerSavingMode(msg);
|
||||
break;
|
||||
case "WifiManager:getState": {
|
||||
let net = this.currentNetwork ? netToDOM(this.currentNetwork) : null;
|
||||
let i;
|
||||
for (i = 0; i < this._domManagers.length; ++i) {
|
||||
let obj = this._domManagers[i];
|
||||
if (obj.manager === msg.manager) {
|
||||
obj.count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i === this._domManagers.length) {
|
||||
this._domManagers.push({ manager: msg.manager, count: 1 });
|
||||
if ((i = this._domManagers.indexOf(msg.manager)) === -1) {
|
||||
this._domManagers.push(msg.manager);
|
||||
}
|
||||
|
||||
let net = this.currentNetwork ? netToDOM(this.currentNetwork) : null;
|
||||
return { network: net,
|
||||
connectionInfo: this._lastConnectionInfo,
|
||||
enabled: WifiManager.enabled,
|
||||
status: translateState(WifiManager.state),
|
||||
macAddress: this.macAddress };
|
||||
}
|
||||
case "WifiManager:managerFinished": {
|
||||
for (let i = 0; i < this._domManagers.length; ++i) {
|
||||
let obj = this._domManagers[i];
|
||||
if (obj.manager === msg.manager) {
|
||||
if (--obj.count === 0) {
|
||||
this._domManagers.splice(i, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -2098,6 +2089,79 @@ WifiWorker.prototype = {
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
getWifiScanResults: function(callback) {
|
||||
var count = 0;
|
||||
var timer = null;
|
||||
var self = this;
|
||||
|
||||
self.waitForScan(waitForScanCallback);
|
||||
doScan();
|
||||
function doScan() {
|
||||
WifiManager.scan(true, function (ok) {
|
||||
if (!ok) {
|
||||
if (!timer) {
|
||||
count = 0;
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
}
|
||||
|
||||
if (count++ >= 3) {
|
||||
timer = null;
|
||||
this.wantScanResults.splice(this.wantScanResults.indexOf(waitForScanCallback), 1);
|
||||
callback.onfailure();
|
||||
return;
|
||||
}
|
||||
|
||||
// Else it's still running, continue waiting.
|
||||
timer.initWithCallback(doScan, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function waitForScanCallback(networks) {
|
||||
if (networks === null) {
|
||||
callback.onfailure();
|
||||
return;
|
||||
}
|
||||
|
||||
var wifiScanResults = new Array();
|
||||
var net;
|
||||
for (let net in networks) {
|
||||
let value = networks[net];
|
||||
wifiScanResults.push(transformResult(value));
|
||||
}
|
||||
callback.onready(wifiScanResults.length, wifiScanResults);
|
||||
}
|
||||
|
||||
function transformResult(element) {
|
||||
var result = new WifiScanResult();
|
||||
result.connected = false;
|
||||
for (let id in element) {
|
||||
if (id === "__exposedProps__") {
|
||||
continue;
|
||||
}
|
||||
if (id === "capabilities") {
|
||||
result[id] = 0;
|
||||
var capabilities = element[id];
|
||||
for (let j = 0; j < capabilities.length; j++) {
|
||||
if (capabilities[j] === "WPA-PSK") {
|
||||
result[id] |= Ci.nsIWifiScanResult.WPA_PSK;
|
||||
} else if (capabilities[j] === "WPA-EAP") {
|
||||
result[id] |= Ci.nsIWifiScanResult.WPA_EAP;
|
||||
} else if (capabilities[j] === "WEP") {
|
||||
result[id] |= Ci.nsIWifiScanResult.WEP;
|
||||
} else {
|
||||
result[id] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result[id] = element[id];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
getKnownNetworks: function(msg) {
|
||||
const message = "WifiManager:getKnownNetworks:Return";
|
||||
if (!WifiManager.enabled) {
|
||||
|
@ -8,13 +8,55 @@
|
||||
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(335ff8a0-fb18-11e1-a21f-0800200c9a66)]
|
||||
[scriptable, uuid(cf1ac02b-1f39-446e-815b-651ac78d2233)]
|
||||
interface nsIWifiScanResult : nsISupports {
|
||||
readonly attribute DOMString ssid;
|
||||
readonly attribute DOMString bssid;
|
||||
|
||||
const int32_t WPA_PSK = 0x01;
|
||||
const int32_t WPA_EAP = 0x02;
|
||||
const int32_t WEP = 0x04;
|
||||
readonly attribute uint32_t capabilities;
|
||||
|
||||
/**
|
||||
* Strength of the signal to network.
|
||||
*/
|
||||
readonly attribute uint32_t signalStrength;
|
||||
|
||||
readonly attribute uint32_t relSignalStrength;
|
||||
readonly attribute boolean connected;
|
||||
};
|
||||
|
||||
[scriptable, uuid(a6931ebf-8493-4014-90e2-99f406999982)]
|
||||
interface nsIWifiScanResultsReady : nsISupports {
|
||||
|
||||
/**
|
||||
* Callback with list of networks.
|
||||
*/
|
||||
void onready(in uint32_t count, [array, size_is(count)] in nsIWifiScanResult results);
|
||||
|
||||
/**
|
||||
* Callback if scanning for networks failed after 3 retry attempts.
|
||||
*/
|
||||
void onfailure();
|
||||
};
|
||||
|
||||
[scriptable, uuid(08dfefed-5c5d-4468-8c5d-2c65c24692d9)]
|
||||
interface nsIWifi : nsISupports
|
||||
{
|
||||
/**
|
||||
* Shutdown the wifi system.
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Returns the list of currently available networks as well as the list of
|
||||
* currently configured networks.
|
||||
*
|
||||
* On success a callback is notified with the list of networks.
|
||||
* On failure after 3 scan retry attempts a callback is notified of failure.
|
||||
*/
|
||||
void getWifiScanResults(in nsIWifiScanResultsReady callback);
|
||||
};
|
||||
|
||||
[scriptable, uuid(caa76ee3-8ffe-4ea5-bc59-3b53a9df0d07)]
|
||||
|
@ -402,6 +402,12 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate)
|
||||
};
|
||||
JS_SetSecurityCallbacks(runtime, &securityCallbacks);
|
||||
|
||||
// DOM helpers:
|
||||
static js::DOMCallbacks DOMCallbacks = {
|
||||
InstanceClassHasProtoAtDepth
|
||||
};
|
||||
SetDOMCallbacks(runtime, &DOMCallbacks);
|
||||
|
||||
JSContext* workerCx = JS_NewContext(runtime, 0);
|
||||
if (!workerCx) {
|
||||
JS_DestroyRuntime(runtime);
|
||||
|
@ -286,11 +286,13 @@ private:
|
||||
}
|
||||
|
||||
jsval message;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v", &message)) {
|
||||
jsval transferable = JSVAL_VOID;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/v",
|
||||
&message, &transferable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return worker->PostMessage(aCx, message);
|
||||
return worker->PostMessage(aCx, message, transferable);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2231,7 +2231,8 @@ WorkerPrivateParent<Derived>::ForgetMainThreadObjects(
|
||||
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::PostMessage(JSContext* aCx, jsval aMessage)
|
||||
WorkerPrivateParent<Derived>::PostMessage(JSContext* aCx, jsval aMessage,
|
||||
jsval aTransferable)
|
||||
{
|
||||
AssertIsOnParentThread();
|
||||
|
||||
@ -2265,7 +2266,7 @@ WorkerPrivateParent<Derived>::PostMessage(JSContext* aCx, jsval aMessage)
|
||||
nsTArray<nsCOMPtr<nsISupports> > clonedObjects;
|
||||
|
||||
JSAutoStructuredCloneBuffer buffer;
|
||||
if (!buffer.write(aCx, aMessage, callbacks, &clonedObjects)) {
|
||||
if (!buffer.write(aCx, aMessage, aTransferable, callbacks, &clonedObjects)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3422,7 +3423,8 @@ WorkerPrivate::StopSyncLoop(uint32_t aSyncLoopKey, bool aSyncResult)
|
||||
}
|
||||
|
||||
bool
|
||||
WorkerPrivate::PostMessageToParent(JSContext* aCx, jsval aMessage)
|
||||
WorkerPrivate::PostMessageToParent(JSContext* aCx, jsval aMessage,
|
||||
jsval aTransferable)
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
@ -3434,7 +3436,7 @@ WorkerPrivate::PostMessageToParent(JSContext* aCx, jsval aMessage)
|
||||
nsTArray<nsCOMPtr<nsISupports> > clonedObjects;
|
||||
|
||||
JSAutoStructuredCloneBuffer buffer;
|
||||
if (!buffer.write(aCx, aMessage, callbacks, &clonedObjects)) {
|
||||
if (!buffer.write(aCx, aMessage, aTransferable, callbacks, &clonedObjects)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ public:
|
||||
ForgetMainThreadObjects(nsTArray<nsCOMPtr<nsISupports> >& aDoomed);
|
||||
|
||||
bool
|
||||
PostMessage(JSContext* aCx, jsval aMessage);
|
||||
PostMessage(JSContext* aCx, jsval aMessage, jsval aTransferable);
|
||||
|
||||
uint64_t
|
||||
GetInnerWindowId();
|
||||
@ -662,7 +662,8 @@ public:
|
||||
StopSyncLoop(uint32_t aSyncLoopKey, bool aSyncResult);
|
||||
|
||||
bool
|
||||
PostMessageToParent(JSContext* aCx, jsval aMessage);
|
||||
PostMessageToParent(JSContext* aCx, jsval aMessage,
|
||||
jsval transferable);
|
||||
|
||||
bool
|
||||
NotifyInternal(JSContext* aCx, Status aStatus);
|
||||
|
@ -839,11 +839,13 @@ private:
|
||||
}
|
||||
|
||||
jsval message;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v", &message)) {
|
||||
jsval transferable = JSVAL_VOID;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/v",
|
||||
&message, &transferable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return scope->mWorker->PostMessageToParent(aCx, message);
|
||||
return scope->mWorker->PostMessageToParent(aCx, message, transferable);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -100,6 +100,8 @@ MOCHITEST_FILES = \
|
||||
test_csp.js \
|
||||
test_csp.html^headers^ \
|
||||
csp_worker.js \
|
||||
test_transferable.html \
|
||||
transferable_worker.js \
|
||||
$(NULL)
|
||||
|
||||
_SUBDIRMOCHITEST_FILES = \
|
||||
|
75
dom/workers/test/test_transferable.html
Normal file
75
dom/workers/test/test_transferable.html
Normal file
@ -0,0 +1,75 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Tests of DOM Worker transferable objects
|
||||
-->
|
||||
<head>
|
||||
<title>Test for DOM Worker transferable objects</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" language="javascript">
|
||||
|
||||
function test1(sizes) {
|
||||
if (!sizes.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var size = sizes.pop();
|
||||
|
||||
var worker = new Worker("transferable_worker.js");
|
||||
worker.onmessage = function(event) {
|
||||
ok(event.data.status, event.data.event);
|
||||
if (!event.data.status) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.data.last)
|
||||
return;
|
||||
|
||||
test1(sizes);
|
||||
}
|
||||
worker.onerror = function(event) {
|
||||
ok(false, "No errors!");
|
||||
}
|
||||
|
||||
try {
|
||||
worker.postMessage(42, true);
|
||||
ok(false, "P: PostMessage - Exception for wrong type");
|
||||
} catch(e) {
|
||||
ok(true, "P: PostMessage - Exception for wrong type");
|
||||
}
|
||||
|
||||
try {
|
||||
ab = new ArrayBuffer(size);
|
||||
worker.postMessage(42,[ab, ab]);
|
||||
ok(false, "P: PostMessage - Exception for duplicate");
|
||||
} catch(e) {
|
||||
ok(true, "P: PostMessage - Exception for duplicate");
|
||||
}
|
||||
|
||||
ab = new ArrayBuffer(size);
|
||||
ok(ab.byteLength == size, "P: The size is: " + size + " == " + ab.byteLength);
|
||||
worker.postMessage({ data: 0, timeout: 0, ab: ab, cb: ab, size: size }, [ab]);
|
||||
ok(ab.byteLength == 0, "P: PostMessage - The size is: 0 == " + ab.byteLength)
|
||||
}
|
||||
|
||||
test1([1024 * 1024 * 32, 128, 4]);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
33
dom/workers/test/transferable_worker.js
Normal file
33
dom/workers/test/transferable_worker.js
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
onmessage = function(event) {
|
||||
if (event.data.data == 0) {
|
||||
ab = new ArrayBuffer(event.data.size);
|
||||
postMessage({ event: "W: The size is: " + event.data.size + " == " + ab.byteLength,
|
||||
status: ab.byteLength == event.data.size, last: false });
|
||||
|
||||
postMessage({ event: "W: postMessage with arrayBuffer", status: true,
|
||||
ab: ab, bc: [ ab, ab, { dd: ab } ] }, [ab]);
|
||||
|
||||
postMessage({ event: "W: The size is: 0 == " + ab.byteLength,
|
||||
status: ab.byteLength == 0, last: false });
|
||||
|
||||
postMessage({ event: "last one!", status: true, last: true });
|
||||
|
||||
} else {
|
||||
var worker = new Worker('sync_worker.js');
|
||||
worker.onmessage = function(event) {
|
||||
postMessage(event.data);
|
||||
}
|
||||
worker.onsyncmessage = function(event) {
|
||||
var v = postSyncMessage(event.data, null, 500);
|
||||
event.reply(v);
|
||||
}
|
||||
|
||||
--event.data.data;
|
||||
worker.postMessage(event.data);
|
||||
}
|
||||
}
|
@ -2711,8 +2711,8 @@ DrawTargetD2D::SetScissorToRect(IntRect *aRect)
|
||||
rect.top = aRect->y;
|
||||
rect.bottom = aRect->YMost();
|
||||
} else {
|
||||
rect.left = rect.left = INT32_MIN;
|
||||
rect.right = rect.top = INT32_MAX;
|
||||
rect.left = rect.top = INT32_MIN;
|
||||
rect.right = rect.bottom = INT32_MAX;
|
||||
}
|
||||
|
||||
mDevice->RSSetScissorRects(1, &rect);
|
||||
|
@ -45,7 +45,7 @@ inline PRLogModuleLevel PRLogLevelForLevel(int aLevel) {
|
||||
|
||||
extern int sGfxLogLevel;
|
||||
|
||||
static void OutputMessage(const std::string &aString, int aLevel) {
|
||||
static inline void OutputMessage(const std::string &aString, int aLevel) {
|
||||
#if defined(WIN32) && !defined(PR_LOGGING)
|
||||
if (aLevel >= sGfxLogLevel) {
|
||||
::OutputDebugStringA(aString.c_str());
|
||||
|
@ -1675,7 +1675,7 @@ public:
|
||||
Extensions_Max
|
||||
};
|
||||
|
||||
bool IsExtensionSupported(GLExtensions aKnownExtension) {
|
||||
bool IsExtensionSupported(GLExtensions aKnownExtension) const {
|
||||
return mAvailableExtensions[aKnownExtension];
|
||||
}
|
||||
|
||||
@ -1737,6 +1737,11 @@ public:
|
||||
return extensions[index];
|
||||
}
|
||||
|
||||
const bool& operator[](size_t index) const {
|
||||
MOZ_ASSERT(index < Size, "out of range");
|
||||
return extensions[index];
|
||||
}
|
||||
|
||||
bool extensions[Size];
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ static void DrawDebugOverlay(gfxImageSurface* imgSurf, int x, int y)
|
||||
|
||||
// Draw text using cairo toy text API
|
||||
cairo_t* cr = c.GetCairo();
|
||||
cairo_set_font_size(cr, 10);
|
||||
cairo_set_font_size(cr, 25);
|
||||
cairo_text_extents_t extents;
|
||||
cairo_text_extents(cr, ss.str().c_str(), &extents);
|
||||
|
||||
@ -36,16 +36,16 @@ static void DrawDebugOverlay(gfxImageSurface* imgSurf, int x, int y)
|
||||
|
||||
c.NewPath();
|
||||
c.SetDeviceColor(gfxRGBA(0.0, 0.0, 0.0, 1.0));
|
||||
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 15)));
|
||||
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30)));
|
||||
c.Fill();
|
||||
|
||||
c.NewPath();
|
||||
c.SetDeviceColor(gfxRGBA(1.0, 0.0, 0.0, 1.0));
|
||||
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 15)));
|
||||
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30)));
|
||||
c.Stroke();
|
||||
|
||||
c.NewPath();
|
||||
cairo_move_to(cr, 4, 13);
|
||||
cairo_move_to(cr, 4, 28);
|
||||
cairo_show_text(cr, ss.str().c_str());
|
||||
|
||||
}
|
||||
@ -86,7 +86,22 @@ BasicTiledLayerBuffer::PaintThebes(BasicTiledThebesLayer* aLayer,
|
||||
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
||||
long start = PR_IntervalNow();
|
||||
#endif
|
||||
if (UseSinglePaintBuffer()) {
|
||||
|
||||
// If this region is empty XMost() - 1 will give us a negative value.
|
||||
NS_ASSERTION(!aPaintRegion.GetBounds().IsEmpty(), "Empty paint region\n");
|
||||
|
||||
bool useSinglePaintBuffer = UseSinglePaintBuffer();
|
||||
if (useSinglePaintBuffer) {
|
||||
// Check if the paint only spans a single tile. If that's
|
||||
// the case there's no point in using a single paint buffer.
|
||||
nsIntRect paintBounds = aPaintRegion.GetBounds();
|
||||
useSinglePaintBuffer = GetTileStart(paintBounds.x) !=
|
||||
GetTileStart(paintBounds.XMost() - 1) ||
|
||||
GetTileStart(paintBounds.y) !=
|
||||
GetTileStart(paintBounds.YMost() - 1);
|
||||
}
|
||||
|
||||
if (useSinglePaintBuffer) {
|
||||
const nsIntRect bounds = aPaintRegion.GetBounds();
|
||||
{
|
||||
SAMPLE_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBufferAlloc");
|
||||
@ -161,8 +176,8 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
|
||||
|
||||
// Bug 742100, this gfxContext really should live on the stack.
|
||||
nsRefPtr<gfxContext> ctxt = new gfxContext(writableSurface);
|
||||
ctxt->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
if (mSinglePaintBuffer) {
|
||||
ctxt->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctxt->NewPath();
|
||||
ctxt->SetSource(mSinglePaintBuffer.get(),
|
||||
gfxPoint(mSinglePaintBufferOffset.x - aDirtyRect.x + drawRect.x,
|
||||
@ -173,7 +188,7 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
|
||||
ctxt->NewPath();
|
||||
ctxt->Translate(gfxPoint(-aTileOrigin.x, -aTileOrigin.y));
|
||||
nsIntPoint a = aTileOrigin;
|
||||
mCallback(mThebesLayer, ctxt, nsIntRegion(nsIntRect(a, nsIntSize(GetTileLength(), GetTileLength()))), aDirtyRect, mCallbackData);
|
||||
mCallback(mThebesLayer, ctxt, nsIntRegion(nsIntRect(a, nsIntSize(GetTileLength(), GetTileLength()))), nsIntRegion(), mCallbackData);
|
||||
}
|
||||
|
||||
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||
|
@ -921,7 +921,7 @@ LayerManagerOGL::Render()
|
||||
|
||||
mGLContext->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||
|
||||
// If the Java compositor is being used, this clear will be done in
|
||||
// If the Android compositor is being used, this clear will be done in
|
||||
// DrawWindowUnderlay. Make sure the bits used here match up with those used
|
||||
// in mobile/android/base/gfx/LayerRenderer.java
|
||||
#ifndef MOZ_ANDROID_OMTC
|
||||
|
@ -207,7 +207,7 @@ gfxContext::Restore()
|
||||
|
||||
mStateStack.RemoveElementAt(mStateStack.Length() - 1);
|
||||
|
||||
if (mPathBuilder || mPath || mPathIsRect) {
|
||||
if ((mPathBuilder || mPath || mPathIsRect) && !mTransformChanged) {
|
||||
// Support here isn't fully correct if the path is continued -after-
|
||||
// the restore. We don't currently have users that do this and we should
|
||||
// make sure there will not be any. Sadly we can't assert this easily.
|
||||
@ -1455,24 +1455,10 @@ gfxContext::PushGroup(gfxASurface::gfxContentType content)
|
||||
if (mCairo) {
|
||||
cairo_push_group_with_content(mCairo, (cairo_content_t) content);
|
||||
} else {
|
||||
Rect clipBounds = GetAzureDeviceSpaceClipBounds();
|
||||
clipBounds.RoundOut();
|
||||
PushNewDT(content);
|
||||
|
||||
clipBounds.width = NS_MAX(1.0f, clipBounds.width);
|
||||
clipBounds.height = NS_MAX(1.0f, clipBounds.height);
|
||||
|
||||
RefPtr<DrawTarget> newDT =
|
||||
mDT->CreateSimilarDrawTarget(IntSize(int32_t(clipBounds.width), int32_t(clipBounds.height)),
|
||||
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content));
|
||||
|
||||
Save();
|
||||
|
||||
CurrentState().drawTarget = newDT;
|
||||
CurrentState().deviceOffset = clipBounds.TopLeft();
|
||||
|
||||
PushClipsToDT(newDT);
|
||||
newDT->SetTransform(GetDTTransform());
|
||||
mDT = newDT;
|
||||
PushClipsToDT(mDT);
|
||||
mDT->SetTransform(GetDTTransform());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1541,19 +1527,20 @@ gfxContext::PushGroupAndCopyBackground(gfxASurface::gfxContentType content)
|
||||
DrawTarget *oldDT = mDT;
|
||||
RefPtr<SourceSurface> source = mDT->Snapshot();
|
||||
Point oldDeviceOffset = CurrentState().deviceOffset;
|
||||
PushGroup(content);
|
||||
|
||||
Point offset = CurrentState().deviceOffset - oldDeviceOffset;
|
||||
PushGroup(gfxASurface::CONTENT_COLOR);
|
||||
PushNewDT(gfxASurface::CONTENT_COLOR);
|
||||
Rect surfRect(0, 0, Float(mDT->GetSize().width), Float(mDT->GetSize().height));
|
||||
Rect sourceRect = surfRect;
|
||||
sourceRect.x += offset.x;
|
||||
sourceRect.y += offset.y;
|
||||
Matrix oldTransform = mDT->GetTransform();
|
||||
|
||||
mDT->SetTransform(Matrix());
|
||||
mDT->DrawSurface(source, surfRect, sourceRect);
|
||||
mDT->SetTransform(oldTransform);
|
||||
mDT->SetOpaqueRect(oldDT->GetOpaqueRect());
|
||||
|
||||
PushClipsToDT(mDT);
|
||||
mDT->SetTransform(GetDTTransform());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2168,4 +2155,25 @@ gfxContext::GetDTTransform() const
|
||||
mat._31 -= CurrentState().deviceOffset.x;
|
||||
mat._32 -= CurrentState().deviceOffset.y;
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::PushNewDT(gfxASurface::gfxContentType content)
|
||||
{
|
||||
Rect clipBounds = GetAzureDeviceSpaceClipBounds();
|
||||
clipBounds.RoundOut();
|
||||
|
||||
clipBounds.width = NS_MAX(1.0f, clipBounds.width);
|
||||
clipBounds.height = NS_MAX(1.0f, clipBounds.height);
|
||||
|
||||
RefPtr<DrawTarget> newDT =
|
||||
mDT->CreateSimilarDrawTarget(IntSize(int32_t(clipBounds.width), int32_t(clipBounds.height)),
|
||||
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content));
|
||||
|
||||
Save();
|
||||
|
||||
CurrentState().drawTarget = newDT;
|
||||
CurrentState().deviceOffset = clipBounds.TopLeft();
|
||||
|
||||
mDT = newDT;
|
||||
}
|
||||
|
@ -753,6 +753,7 @@ private:
|
||||
Rect GetAzureDeviceSpaceClipBounds();
|
||||
Matrix GetDeviceTransform() const;
|
||||
Matrix GetDTTransform() const;
|
||||
void PushNewDT(gfxASurface::gfxContentType content);
|
||||
|
||||
bool mPathIsRect;
|
||||
bool mTransformChanged;
|
||||
|
@ -18,6 +18,9 @@
|
||||
#elif defined(ANDROID)
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "gfxAndroidPlatform.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
#define gfxToolkitPlatform gfxAndroidPlatform
|
||||
#endif
|
||||
|
||||
@ -851,6 +854,131 @@ FinalizeFamilyMemberList(nsStringHashKey::KeyType aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
#define JAR_READ_BUFFER_SIZE 1024
|
||||
|
||||
nsresult
|
||||
CopyFromUriToFile(nsCString aSpec, nsIFile* aLocalFile)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(inputStream), uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outputStream;
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), aLocalFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char buf[JAR_READ_BUFFER_SIZE];
|
||||
while (true) {
|
||||
PRUint32 read;
|
||||
PRUint32 written;
|
||||
|
||||
rv = inputStream->Read(buf, JAR_READ_BUFFER_SIZE, &read);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = outputStream->Write(buf, read, &written);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (written != read) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (read != JAR_READ_BUFFER_SIZE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define JAR_LAST_MODIFED_TIME "jar-last-modified-time"
|
||||
|
||||
void ExtractFontsFromJar(nsIFile* aLocalDir)
|
||||
{
|
||||
bool exists;
|
||||
bool allFontsExtracted = true;
|
||||
nsCString jarPath;
|
||||
int64_t jarModifiedTime;
|
||||
uint32_t longSize;
|
||||
char* cachedModifiedTimeBuf;
|
||||
nsZipFind* find;
|
||||
|
||||
nsRefPtr<nsZipArchive> reader = Omnijar::GetReader(Omnijar::Type::GRE);
|
||||
nsCOMPtr<nsIFile> jarFile = Omnijar::GetPath(Omnijar::Type::GRE);
|
||||
|
||||
Omnijar::GetURIString(Omnijar::Type::GRE, jarPath);
|
||||
jarFile->GetLastModifiedTime(&jarModifiedTime);
|
||||
|
||||
mozilla::scache::StartupCache* cache = mozilla::scache::StartupCache::GetSingleton();
|
||||
if (NS_SUCCEEDED(cache->GetBuffer(JAR_LAST_MODIFED_TIME, &cachedModifiedTimeBuf, &longSize))
|
||||
&& longSize == sizeof(int64_t)) {
|
||||
if (jarModifiedTime < *((int64_t*) cachedModifiedTimeBuf)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aLocalDir->Exists(&exists);
|
||||
if (!exists) {
|
||||
aLocalDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
|
||||
}
|
||||
|
||||
static const char* sJarSearchPaths[] = {
|
||||
"res/fonts/*.ttf$",
|
||||
};
|
||||
|
||||
for (int i = 0; i < ArrayLength(sJarSearchPaths); i++) {
|
||||
reader->FindInit(sJarSearchPaths[i], &find);
|
||||
while (true) {
|
||||
const char* tmpPath;
|
||||
uint16_t len;
|
||||
find->FindNext(&tmpPath, &len);
|
||||
if (!tmpPath) {
|
||||
break;
|
||||
}
|
||||
|
||||
nsCString path(tmpPath, len);
|
||||
nsCOMPtr<nsIFile> localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
|
||||
if (NS_FAILED(localFile->InitWithFile(aLocalDir))) {
|
||||
allFontsExtracted = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
PRInt32 lastSlash = path.RFindChar('/');
|
||||
nsCString fileName;
|
||||
if (lastSlash == kNotFound) {
|
||||
fileName = path;
|
||||
} else {
|
||||
fileName = Substring(path, lastSlash + 1);
|
||||
}
|
||||
if (NS_FAILED(localFile->AppendNative(fileName))) {
|
||||
allFontsExtracted = false;
|
||||
continue;
|
||||
}
|
||||
int64_t lastModifiedTime;
|
||||
localFile->Exists(&exists);
|
||||
localFile->GetLastModifiedTime(&lastModifiedTime);
|
||||
if (!exists || lastModifiedTime < jarModifiedTime) {
|
||||
nsCString spec;
|
||||
spec.Append(jarPath);
|
||||
spec.Append(path);
|
||||
if (NS_FAILED(CopyFromUriToFile(spec, localFile))) {
|
||||
localFile->Remove(true);
|
||||
allFontsExtracted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allFontsExtracted) {
|
||||
cache->PutBuffer(JAR_LAST_MODIFED_TIME, (char*)&jarModifiedTime, sizeof(int64_t));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
gfxFT2FontList::FindFonts()
|
||||
{
|
||||
@ -937,6 +1065,48 @@ gfxFT2FontList::FindFonts()
|
||||
}
|
||||
root.Append("/fonts");
|
||||
|
||||
FindFontsInDir(root, &fnc);
|
||||
|
||||
if (mFontFamilies.Count() == 0) {
|
||||
// if we can't find/read the font directory, we are doomed!
|
||||
NS_RUNTIMEABORT("Could not read the system fonts directory");
|
||||
}
|
||||
|
||||
// look for fonts shipped with the product
|
||||
nsCOMPtr<nsIFile> localDir;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_RES_DIR,
|
||||
getter_AddRefs(localDir));
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(localDir->Append(NS_LITERAL_STRING("fonts")))) {
|
||||
ExtractFontsFromJar(localDir);
|
||||
nsCString localPath;
|
||||
rv = localDir->GetNativePath(localPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
FindFontsInDir(localPath, &fnc);
|
||||
}
|
||||
}
|
||||
|
||||
// look for locally-added fonts in the profile
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
|
||||
getter_AddRefs(localDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCString localPath;
|
||||
rv = localDir->GetNativePath(localPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
FindFontsInDir(localPath, &fnc);
|
||||
}
|
||||
}
|
||||
|
||||
// Finalize the families by sorting faces into standard order
|
||||
// and marking "simple" families.
|
||||
// Passing non-null userData here says that we want faces to be sorted.
|
||||
mFontFamilies.Enumerate(FinalizeFamilyMemberList, this);
|
||||
#endif // XP_WIN && ANDROID
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
void
|
||||
gfxFT2FontList::FindFontsInDir(const nsCString& aDir, FontNameCache *aFNC)
|
||||
{
|
||||
static const char* sStandardFonts[] = {
|
||||
"DroidSans.ttf",
|
||||
"DroidSans-Bold.ttf",
|
||||
@ -954,10 +1124,9 @@ gfxFT2FontList::FindFonts()
|
||||
"DroidSansFallback.ttf"
|
||||
};
|
||||
|
||||
DIR *d = opendir(root.get());
|
||||
DIR *d = opendir(aDir.get());
|
||||
if (!d) {
|
||||
// if we can't find/read the font directory, we are doomed!
|
||||
NS_RUNTIMEABORT("Could not read the system fonts directory");
|
||||
return;
|
||||
}
|
||||
|
||||
struct dirent *ent = NULL;
|
||||
@ -970,16 +1139,14 @@ gfxFT2FontList::FindFonts()
|
||||
const char *ext = ent->d_name + namelen - 4;
|
||||
if (strcasecmp(ext, ".ttf") == 0 ||
|
||||
strcasecmp(ext, ".otf") == 0 ||
|
||||
strcasecmp(ext, ".ttc") == 0)
|
||||
{
|
||||
strcasecmp(ext, ".ttc") == 0) {
|
||||
bool isStdFont = false;
|
||||
for (unsigned int i = 0;
|
||||
i < ArrayLength(sStandardFonts) && !isStdFont; i++)
|
||||
{
|
||||
i < ArrayLength(sStandardFonts) && !isStdFont; i++) {
|
||||
isStdFont = strcmp(sStandardFonts[i], ent->d_name) == 0;
|
||||
}
|
||||
|
||||
nsCString s(root);
|
||||
nsCString s(aDir);
|
||||
s.Append('/');
|
||||
s.Append(ent->d_name, namelen);
|
||||
|
||||
@ -987,17 +1154,13 @@ gfxFT2FontList::FindFonts()
|
||||
// note that if we have cached info for this file in fnc,
|
||||
// and the file is unchanged, we won't actually need to read it.
|
||||
// If the file is new/changed, this will update the FontNameCache.
|
||||
AppendFacesFromFontFile(s, isStdFont, &fnc);
|
||||
AppendFacesFromFontFile(s, isStdFont, aFNC);
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
|
||||
// Finalize the families by sorting faces into standard order
|
||||
// and marking "simple" families.
|
||||
// Passing non-null userData here says that we want faces to be sorted.
|
||||
mFontFamilies.Enumerate(FinalizeFamilyMemberList, this);
|
||||
#endif // XP_WIN && ANDROID
|
||||
closedir(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
gfxFT2FontList::AppendFaceFromFontListEntry(const FontListEntry& aFLE,
|
||||
|
@ -130,6 +130,10 @@ protected:
|
||||
nsCString& aFaceList);
|
||||
|
||||
void FindFonts();
|
||||
|
||||
#ifdef ANDROID
|
||||
void FindFontsInDir(const nsCString& aDir, FontNameCache* aFNC);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* GFX_FT2FONTLIST_H */
|
||||
|
@ -623,7 +623,7 @@ gfxUserFontSet::IncrementGeneration()
|
||||
{
|
||||
// add one, increment again if zero
|
||||
LL_ADD(sFontSetGeneration, sFontSetGeneration, 1);
|
||||
if (LL_IS_ZERO(sFontSetGeneration))
|
||||
if (sFontSetGeneration == 0)
|
||||
LL_ADD(sFontSetGeneration, sFontSetGeneration, 1);
|
||||
mGeneration = sFontSetGeneration;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ interface nsIChannelPolicy;
|
||||
* @version 0.3
|
||||
* @see imagelib2
|
||||
*/
|
||||
[scriptable, uuid(20a5e3e9-0d5b-482c-9f41-942b5f19e5a3)]
|
||||
[scriptable, uuid(f5a7c016-8caf-460a-b1a1-3fe5534d5c9e)]
|
||||
interface imgILoader : nsISupports
|
||||
{
|
||||
// Extra flags to pass to loadImage if you want a load to use CORS
|
||||
@ -89,11 +89,4 @@ interface imgILoader : nsISupports
|
||||
in imgIDecoderObserver aObserver,
|
||||
in nsISupports cx,
|
||||
out nsIStreamListener aListener);
|
||||
|
||||
/**
|
||||
* Checks if a decoder for the an image with the given mime type is available
|
||||
* @param mimeType The type to find a decoder for
|
||||
* @return true if a decoder is available, false otherwise
|
||||
*/
|
||||
boolean supportImageWithMimeType(in string mimeType);
|
||||
};
|
||||
|
@ -18,6 +18,10 @@ GRE_MODULE = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
EXPORTS = imgLoader.h \
|
||||
imgRequest.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
Image.cpp \
|
||||
Decoder.cpp \
|
||||
|
@ -89,6 +89,9 @@ ScaleFrameImage(imgFrame *aSrcFrame, imgFrame *aDstFrame,
|
||||
}
|
||||
#endif // MOZ_ENABLE_SKIA
|
||||
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::image;
|
||||
using namespace mozilla::layers;
|
||||
@ -2583,6 +2586,7 @@ RasterImage::RequestDecode()
|
||||
// large images will decode a bit and post themselves to the event loop
|
||||
// to finish decoding.
|
||||
if (!mDecoded && !mInDecoder && mHasSourceData) {
|
||||
SAMPLE_LABEL_PRINTF("RasterImage", "DecodeABitOf", "%s", GetURIString());
|
||||
DecodeWorker::Singleton()->DecodeABitOf(this);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2601,6 +2605,8 @@ RasterImage::SyncDecode()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
SAMPLE_LABEL_PRINTF("RasterImage", "SyncDecode", "%s", GetURIString());;
|
||||
|
||||
// If we're decoded already, no worries
|
||||
if (mDecoded)
|
||||
return NS_OK;
|
||||
@ -2793,6 +2799,19 @@ RasterImage::ScaleRequest::Stop(RasterImage* aImg)
|
||||
request->stopped = true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsDownscale(const gfxSize& scale)
|
||||
{
|
||||
if (scale.width > 1.0)
|
||||
return false;
|
||||
if (scale.height > 1.0)
|
||||
return false;
|
||||
if (scale.width == 1.0 && scale.height == 1.0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
|
||||
gfxSize aScale)
|
||||
@ -2800,8 +2819,7 @@ RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
|
||||
// The high-quality scaler requires Skia.
|
||||
#ifdef MOZ_ENABLE_SKIA
|
||||
if (gHQDownscaling && aFilter == gfxPattern::FILTER_GOOD &&
|
||||
!mAnim && mDecoded &&
|
||||
(aScale.width <= 1.0 && aScale.height <= 1.0)) {
|
||||
!mAnim && mDecoded && IsDownscale(aScale)) {
|
||||
gfxFloat factor = gHQDownscalingMinFactor / 1000.0;
|
||||
return (aScale.width < factor || aScale.height < factor);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user