This commit is contained in:
Daniel Holbert 2011-08-15 21:12:06 -07:00
Родитель 9e21b178aa 5edc5ea331
Коммит c35631abba
67 изменённых файлов: 1300 добавлений и 662 удалений

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

@ -202,6 +202,20 @@ nsNullPrincipalURI::GetSpec(nsACString &_spec)
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsNullPrincipalURI::GetSpecIgnoringRef(nsACString &result)
{
return GetSpec(result);
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHasRef(PRBool *result)
{
*result = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetSpec(const nsACString &aSpec)
{

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

@ -937,6 +937,16 @@ WebGLContext::MozGetUnderlyingParamString(PRUint32 pname, nsAString& retval)
return NS_OK;
}
bool WebGLContext::IsExtensionSupported(WebGLExtensionID ei)
{
if (ei == WebGL_OES_texture_float) {
MakeContextCurrent();
return gl->IsExtensionSupported(gl->IsGLES2() ? GLContext::OES_texture_float
: GLContext::ARB_texture_float);
}
return false;
}
NS_IMETHODIMP
WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
{
@ -945,10 +955,7 @@ WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
// handle simple extensions that don't need custom objects first
WebGLExtensionID ei = WebGLExtensionID_Max;
if (aName.EqualsLiteral("OES_texture_float")) {
MakeContextCurrent();
PRBool avail = gl->IsExtensionSupported(gl->IsGLES2() ? "GL_OES_texture_float" : "GL_ARB_texture_float");
if (avail)
if (IsExtensionSupported(WebGL_OES_texture_float))
ei = WebGL_OES_texture_float;
}
@ -1245,7 +1252,8 @@ WebGLContext::GetSupportedExtensions(nsIVariant **retval)
nsTArray<const char *> extList;
/* no extensions to add to extList */
if (IsExtensionSupported(WebGL_OES_texture_float))
extList.InsertElementAt(extList.Length(), "OES_texture_float");
nsresult rv;
if (extList.Length() > 0) {

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

@ -472,6 +472,7 @@ protected:
NS_ABORT_IF_FALSE(ext >= 0 && ext < WebGLExtensionID_Max, "bogus index!");
return mEnabledExtensions[ext] != nsnull;
}
bool IsExtensionSupported(WebGLExtensionID ei);
PRBool InitAndValidateGL();
PRBool ValidateBuffers(PRInt32* maxAllowedCount, const char *info);

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

@ -599,6 +599,19 @@ ContentParent::RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32
return true;
}
bool
ContentParent::RecvGetShowPasswordSetting(PRBool* showPassword)
{
// default behavior is to show the last password character
*showPassword = PR_TRUE;
#ifdef ANDROID
NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available");
if (AndroidBridge::Bridge() != nsnull)
*showPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
#endif
return true;
}
NS_IMPL_THREADSAFE_ISUPPORTS4(ContentParent,
nsIObserver,
nsIThreadObserver,

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

@ -167,6 +167,7 @@ private:
virtual bool RecvGetSystemColors(const PRUint32& colorsCount, InfallibleTArray<PRUint32>* colors);
virtual bool RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32& aIconSize, InfallibleTArray<PRUint8>* bits);
virtual bool RecvGetShowPasswordSetting(PRBool* showPassword);
virtual bool RecvStartVisitedQuery(const IPC::URI& uri);

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

@ -205,6 +205,9 @@ parent:
sync GetIconForExtension(nsCString aFileExt, PRUint32 aIconSize)
returns (PRUint8[] bits);
sync GetShowPasswordSetting()
returns (PRBool showPassword);
both:
AsyncMessage(nsString aMessage, nsString aJSON);

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

@ -62,6 +62,7 @@ import android.telephony.*;
import android.webkit.MimeTypeMap;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.provider.Settings;
import android.util.*;
import android.net.Uri;
@ -1366,4 +1367,16 @@ public class GeckoAppShell
return activityInfo.loadIcon(pm);
}
public static boolean getShowPasswordSetting() {
try {
int showPassword =
Settings.System.getInt(GeckoApp.mAppContext.getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD);
return (showPassword > 0);
}
catch (Exception e) {
return false;
}
}
}

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

@ -62,6 +62,7 @@ VPATH += $(srcdir)/src/compiler/preprocessor
CPPSRCS = \
Compiler.cpp \
DetectRecursion.cpp \
InfoSink.cpp \
Initialize.cpp \
InitializeDll.cpp \

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

@ -1,6 +1,6 @@
This is the ANGLE project, from http://code.google.com/p/angleproject/.
Current revision: r653
Current revision: r686
== Applied local patches ==
@ -14,6 +14,8 @@ In this order:
angle-r712.patch - this is ANGLE r712
angle-win64.patch - Win64 support. This is ANGLE r697
angle-r707.patch - this is ANGLE r707 for Win64 bug fix
angle-r719.patch - this is ANGLE r719
angle-r711.patch - this is ANGLE r711
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.

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

@ -4,6 +4,7 @@
// found in the LICENSE file.
//
#include "compiler/DetectRecursion.h"
#include "compiler/Initialize.h"
#include "compiler/ParseHelper.h"
#include "compiler/ShHandle.h"
@ -145,13 +146,16 @@ bool TCompiler::compile(const char* const shaderStrings[],
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
if (success)
success = detectRecursion(root);
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
success = validateLimitations(root);
// Call mapLongVariableNames() before collectAttribsUniforms() so in
// collectAttribsUniforms() we already have the mapped symbol names and
// we could composite mapped and original variable names.
if (compileOptions & SH_MAP_LONG_VARIABLE_NAMES)
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES))
mapLongVariableNames(root);
if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
@ -193,6 +197,25 @@ void TCompiler::clearResults()
uniforms.clear();
}
bool TCompiler::detectRecursion(TIntermNode* root)
{
DetectRecursion detect;
root->traverse(&detect);
switch (detect.detectRecursion()) {
case DetectRecursion::kErrorNone:
return true;
case DetectRecursion::kErrorMissingMain:
infoSink.info.message(EPrefixError, "Missing main()");
return false;
case DetectRecursion::kErrorRecursion:
infoSink.info.message(EPrefixError, "Function recursion detected");
return false;
default:
UNREACHABLE();
return false;
}
}
bool TCompiler::validateLimitations(TIntermNode* root) {
ValidateLimitations validate(shaderType, infoSink.info);
root->traverse(&validate);

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

@ -0,0 +1,158 @@
//
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/DetectRecursion.h"
DetectRecursion::FunctionNode::FunctionNode(const TString& fname)
: name(fname),
visit(PreVisit)
{
}
const TString& DetectRecursion::FunctionNode::getName() const
{
return name;
}
void DetectRecursion::FunctionNode::addCallee(
DetectRecursion::FunctionNode* callee)
{
for (size_t i = 0; i < callees.size(); ++i) {
if (callees[i] == callee)
return;
}
callees.push_back(callee);
}
bool DetectRecursion::FunctionNode::detectRecursion()
{
ASSERT(visit == PreVisit);
visit = InVisit;
for (size_t i = 0; i < callees.size(); ++i) {
switch (callees[i]->visit) {
case InVisit:
// cycle detected, i.e., recursion detected.
return true;
case PostVisit:
break;
case PreVisit: {
bool recursion = callees[i]->detectRecursion();
if (recursion)
return true;
break;
}
default:
UNREACHABLE();
break;
}
}
visit = PostVisit;
return false;
}
DetectRecursion::DetectRecursion()
: currentFunction(NULL)
{
}
DetectRecursion::~DetectRecursion()
{
for (int i = 0; i < functions.size(); ++i)
delete functions[i];
}
void DetectRecursion::visitSymbol(TIntermSymbol*)
{
}
void DetectRecursion::visitConstantUnion(TIntermConstantUnion*)
{
}
bool DetectRecursion::visitBinary(Visit, TIntermBinary*)
{
return true;
}
bool DetectRecursion::visitUnary(Visit, TIntermUnary*)
{
return true;
}
bool DetectRecursion::visitSelection(Visit, TIntermSelection*)
{
return true;
}
bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
{
switch (node->getOp())
{
case EOpPrototype:
// Function declaration.
// Don't add FunctionNode here because node->getName() is the
// unmangled function name.
break;
case EOpFunction: {
// Function definition.
if (visit == PreVisit) {
currentFunction = findFunctionByName(node->getName());
if (currentFunction == NULL) {
currentFunction = new FunctionNode(node->getName());
functions.push_back(currentFunction);
}
}
break;
}
case EOpFunctionCall: {
// Function call.
if (visit == PreVisit) {
ASSERT(currentFunction != NULL);
FunctionNode* func = findFunctionByName(node->getName());
if (func == NULL) {
func = new FunctionNode(node->getName());
functions.push_back(func);
}
currentFunction->addCallee(func);
}
break;
}
default:
break;
}
return true;
}
bool DetectRecursion::visitLoop(Visit, TIntermLoop*)
{
return true;
}
bool DetectRecursion::visitBranch(Visit, TIntermBranch*)
{
return true;
}
DetectRecursion::ErrorCode DetectRecursion::detectRecursion()
{
FunctionNode* main = findFunctionByName("main(");
if (main == NULL)
return kErrorMissingMain;
if (main->detectRecursion())
return kErrorRecursion;
return kErrorNone;
}
DetectRecursion::FunctionNode* DetectRecursion::findFunctionByName(
const TString& name)
{
for (size_t i = 0; i < functions.size(); ++i) {
if (functions[i]->getName() == name)
return functions[i];
}
return NULL;
}

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

@ -0,0 +1,67 @@
//
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef COMPILER_DETECT_RECURSION_H_
#define COMPILER_DETECT_RECURSION_H_
#include "GLSLANG/ShaderLang.h"
#include "compiler/intermediate.h"
#include "compiler/VariableInfo.h"
// Traverses intermediate tree to detect function recursion.
class DetectRecursion : public TIntermTraverser {
public:
enum ErrorCode {
kErrorMissingMain,
kErrorRecursion,
kErrorNone
};
DetectRecursion();
~DetectRecursion();
virtual void visitSymbol(TIntermSymbol*);
virtual void visitConstantUnion(TIntermConstantUnion*);
virtual bool visitBinary(Visit, TIntermBinary*);
virtual bool visitUnary(Visit, TIntermUnary*);
virtual bool visitSelection(Visit, TIntermSelection*);
virtual bool visitAggregate(Visit, TIntermAggregate*);
virtual bool visitLoop(Visit, TIntermLoop*);
virtual bool visitBranch(Visit, TIntermBranch*);
ErrorCode detectRecursion();
private:
class FunctionNode {
public:
FunctionNode(const TString& fname);
const TString& getName() const;
// If a function is already in the callee list, this becomes a no-op.
void addCallee(FunctionNode* callee);
// Return true if recursive function calls are detected.
bool detectRecursion();
private:
// mangled function name is unique.
TString name;
// functions that are directly called by this function.
TVector<FunctionNode*> callees;
Visit visit;
};
FunctionNode* findFunctionByName(const TString& name);
TVector<FunctionNode*> functions;
FunctionNode* currentFunction;
};
#endif // COMPILER_DETECT_RECURSION_H_

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

@ -66,6 +66,8 @@ protected:
bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
// Clears the results from the previous compilation.
void clearResults();
// Return true if function recursion is detected.
bool detectRecursion(TIntermNode* root);
// Returns true if the given shader does not exceed the minimum
// functionality mandated in GLSL 1.0 spec Appendix A.
bool validateLimitations(TIntermNode* root);

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

@ -76,6 +76,7 @@ VPATH += $(srcdir)/.. \
CPPSRCS = \
Compiler.cpp \
DetectRecursion.cpp \
InfoSink.cpp \
Initialize.cpp \
InitializeDll.cpp \

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

@ -2109,16 +2109,16 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
IDirect3DSurface9 *systemSurface;
HRESULT result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &systemSurface, NULL);
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return error(GL_OUT_OF_MEMORY);
}
ASSERT(SUCCEEDED(result));
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
{
UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
return error(GL_OUT_OF_MEMORY);
}
result = device->GetRenderTargetData(renderTarget, systemSurface);

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

@ -76,6 +76,7 @@ VPATH += $(srcdir)/../common
CPPSRCS = \
Compiler.cpp \
DetectRecursion.cpp \
InfoSink.cpp \
Initialize.cpp \
InitializeDll.cpp \

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

@ -434,6 +434,8 @@ static const char *sExtensionNames[] = {
"GL_ARB_texture_non_power_of_two",
"GL_ARB_pixel_buffer_object",
"GL_ARB_ES2_compatibility",
"GL_OES_texture_float",
"GL_ARB_texture_float",
NULL
};

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

@ -959,6 +959,8 @@ public:
ARB_texture_non_power_of_two,
ARB_pixel_buffer_object,
ARB_ES2_compatibility,
OES_texture_float,
ARB_texture_float,
Extensions_Max
};

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

@ -1348,7 +1348,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
logBuffer.Append(bytes.ptr());
logBuffer.AppendLiteral(" ");
if (i == symbolCount - 1) {
LOG(("%s] from %s\n", PromiseFlatCString(logBuffer).get(),
LOG(("%s] from %s\n", logBuffer.get(),
PromiseFlatCString(aLocation).get()));
}
#endif

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

@ -0,0 +1,125 @@
var MasterPasswordUI = {
_dialog: null,
_tokenName: "",
get _secModuleDB() {
delete this._secModuleDB;
return this._secModuleDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].getService(Ci.nsIPKCS11ModuleDB);
},
get _pk11DB() {
delete this._pk11DB;
return this._pk11DB = Cc["@mozilla.org/security/pk11tokendb;1"].getService(Ci.nsIPK11TokenDB);
},
_setPassword: function _setPassword(password) {
try {
let status;
let slot = this._secModuleDB.findSlotByName(this._tokenName);
if (slot)
status = slot.status;
else
return false;
let token = this._pk11DB.findTokenByName(this._tokenName);
if (status == Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED) {
token.initPassword(password);
} else if (status == Ci.nsIPKCS11Slot.SLOT_READY) {
token.changePassword("", password);
}
return true;
} catch(e) {
dump("--- MasterPasswordUI._setPassword exception: " + e + "\n");
return false;
}
},
_removePassword: function _removePassword(password) {
try {
let token = this._pk11DB.getInternalKeyToken();
if (token.checkPassword(password)) {
token.changePassword(password, "");
return true;
}
} catch(e) {
dump("--- MasterPasswordUI._removePassword exception: " + e + "\n");
}
return false;
},
show: function mp_show(aSet) {
let dialogId = aSet ? "masterpassword-change" : "masterpassword-remove";
if (document.getElementById(dialogId))
return;
let dialog = aSet ? "chrome://browser/content/masterPassword.xul"
: "chrome://browser/content/removeMasterPassword.xul";
this._dialog = importDialog(window, dialog, null);
BrowserUI.pushPopup(this, this._dialog);
if (aSet) {
this.checkPassword();
document.getElementById("masterpassword-newpassword1").focus();
} else {
document.getElementById("masterpassword-oldpassword").focus();
}
},
hide: function mp_hide(aValue) {
this.updatePreference();
this._dialog.close();
this._dialog = null;
BrowserUI.popPopup(this);
},
setPassword: function mp_setPassword() {
if (!this.checkPassword())
return;
let newPasswordValue = document.getElementById("masterpassword-newpassword1").value;
if (this._setPassword(newPasswordValue)) {
this.hide();
}
},
removePassword: function mp_removePassword() {
let oldPassword = document.getElementById("masterpassword-oldpassword").value;
if (this._removePassword(oldPassword)) {
this.hide();
}
},
checkPassword: function mp_checkPassword() {
let newPasswordValue1 = document.getElementById("masterpassword-newpassword1").value;
let newPasswordValue2 = document.getElementById("masterpassword-newpassword2").value;
let buttonOk = this._dialog.getElementsByAttribute("class", "prompt-buttons")[0].firstChild;
let isPasswordValid = this._secModuleDB.isFIPSEnabled ? (newPasswordValue1 != "" && newPasswordValue1 == newPasswordValue2)
: (newPasswordValue1 == newPasswordValue2);
buttonOk.setAttribute("disabled", !isPasswordValid);
return isPasswordValid;
},
checkOldPassword: function mp_checkOldPassword() {
let oldPassword = document.getElementById("masterpassword-oldpassword");
let buttonOk = this._dialog.getElementsByAttribute("class", "prompt-buttons")[0].firstChild;
let isPasswordValid = this._pk11DB.getInternalKeyToken().checkPassword(oldPassword.value);
buttonOk.setAttribute("disabled", !isPasswordValid);
},
hasMasterPassword: function mp_hasMasterPassword() {
let slot = this._secModuleDB.findSlotByName(this._tokenName);
if (slot) {
let status = slot.status;
return status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED && status != Ci.nsIPKCS11Slot.SLOT_READY;
}
return false;
},
updatePreference: function mp_updatePreference() {
document.getElementById("prefs-master-password").value = this.hasMasterPassword();
}
};

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

@ -109,6 +109,7 @@ XPCOMUtils.defineLazyGetter(this, "CommonUI", function() {
["ContentPopupHelper", "chrome://browser/content/ContentPopupHelper.js"],
["SharingUI", "chrome://browser/content/SharingUI.js"],
["TabsPopup", "chrome://browser/content/TabsPopup.js"],
["MasterPasswordUI", "chrome://browser/content/MasterPasswordUI.js"],
#ifdef MOZ_SERVICES_SYNC
["WeaveGlue", "chrome://browser/content/sync.js"],
#endif

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

@ -550,7 +550,6 @@ var BrowserUI = {
FullScreenVideo.init();
NewTabPopup.init();
CharsetMenu.init();
WebappsUI.init();
// If some add-ons were disabled during during an application update, alert user
let addonIDs = AddonManager.getStartupChanges("disabled");

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

@ -481,6 +481,7 @@
<setting pref="network.cookie.cookieBehavior" title="&allowCookies.title;" type="boolint" on="0" off="2"/>
<setting pref="signon.rememberSignons" title="&rememberPasswords.title;" type="bool"/>
<setting pref="privacy.donottrackheader.enabled" title="&doNotTrack.title;" type="bool"/>
<setting id="prefs-master-password" title="&masterPassword.title;" type="bool" oncommand="MasterPasswordUI.show(this.value);"/>
<setting title="&clearPrivateData2.title;" type="control">
<button id="prefs-clear-data" label="&clearPrivateData.button;" command="cmd_sanitize"/>
</setting>

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

@ -1677,102 +1677,13 @@ var CharsetMenu = {
var WebappsUI = {
_dialog: null,
_manifest: null,
_perms: [],
_openwebapps: null,
_application: null,
init: function() {
Cu.import("resource:///modules/openWebapps.jsm");
messageManager.addMessageListener("OpenWebapps:Install", this);
messageManager.addMessageListener("OpenWebapps:GetInstalledBy", this);
messageManager.addMessageListener("OpenWebapps:AmInstalled", this);
messageManager.addMessageListener("OpenWebapps:MgmtLaunch", this);
messageManager.addMessageListener("OpenWebapps:MgmtList", this);
messageManager.addMessageListener("OpenWebapps:MgmtUninstall", this);
},
// converts a manifest to an application as expected by openwebapps.install()
convertManifest: function(aData) {
let app = {
manifest : JSON.parse(aData.manifest),
installData : aData.installData,
storeURI : aData.storeURI,
manifestURI : aData.manifestURIs,
capabilities : [],
callbackID : aData.callbackID
}
let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).QueryInterface(Ci.nsIToolkitChromeRegistry);
let locale = chrome.getSelectedLocale("browser");
let localeRoot;
if (app.manifest.locales)
localeRoot = app.manifest.locales[locale];
if (!localeRoot)
localeRoot = app.manifest;
let baseURI = Services.io.newURI(aData.manifestURI, null, null);
app.title = localeRoot.name || app.manifest.name;
// choose the larger icon
let max = 0;
let icon;
for (let size in app.manifest.icons) {
let iSize = parseInt(size);
if (iSize > max) {
icon = baseURI.resolve(app.manifest.icons[size]);
max = iSize;
}
}
if (icon)
app.iconURI = icon;
let root = baseURI.resolve("/").toString();
app.appURI = app.manifest.launch_path ? baseURI.resolve(app.manifest.launch_path) : root.substring(0, root.length - 1);
return app;
},
receiveMessage: function(aMessage) {
let browser = aMessage.target;
switch(aMessage.name) {
case "OpenWebapps:Install":
WebappsUI._openwebapps = browser;
WebappsUI.show(WebappsUI.convertManifest(aMessage.json));
break;
case "OpenWebapps:GetInstalledBy":
let apps = OpenWebapps.getInstalledBy(aMessage.json.storeURI);
browser.messageManager.sendAsyncMessage("OpenWebapps:GetInstalledBy:Return",
{ apps: apps, callbackID: aMessage.json.callbackID });
break;
case "OpenWebapps:AmInstalled":
let app = OpenWebapps.amInstalled(aMessage.json.appURI);
browser.messageManager.sendAsyncMessage("OpenWebapps:AmInstalled:Return",
{ installed: app != null, app: app, callbackID: aMessage.json.callbackID });
break;
case "OpenWebapps:MgmtList":
let list = OpenWebapps.mgmtList();
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
{ ok: true, apps: list, callbackID: aMessage.json.callbackID });
break;
case "OpenWebapps:MgmtLaunch":
let res = OpenWebapps.mgmtLaunch(aMessage.json.origin);
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtLaunch:Return",
{ ok: res, callbackID: aMessage.json.callbackID });
break;
case "OpenWebapps:MgmtUninstall":
let uninstalled = OpenWebapps.mgmtUninstall(aMessage.json.origin);
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
{ ok: uninstalled, callbackID: aMessage.json.callbackID });
break;
}
},
checkBox: function(aEvent) {
let elem = aEvent.originalTarget;
let perm = elem.getAttribute("perm");
if (this._application.capabilities && this._application.capabilities.indexOf(perm) != -1) {
if (this._manifest.capabilities && this._manifest.capabilities.indexOf(perm) != -1) {
if (elem.checked) {
elem.classList.remove("webapps-noperm");
elem.classList.add("webapps-perm");
@ -1783,10 +1694,8 @@ var WebappsUI = {
}
},
show: function show(aApplication) {
if (!aApplication) {
this._openwebapps = null;
show: function show(aManifest) {
if (!aManifest) {
// Try every way to get an icon
let browser = Browser.selectedBrowser;
let icon = browser.appIcon.href;
@ -1795,32 +1704,24 @@ var WebappsUI = {
if (!icon)
icon = gFaviconService.getFaviconImageForPage(browser.currentURI).spec;
// Create a simple application object
aApplication = {
appURI: browser.currentURI.spec,
storeURI: browser.currentURI.spec,
title: browser.contentTitle,
iconURI: icon,
// Create a simple manifest
aManifest = {
uri: browser.currentURI.spec,
name: browser.contentTitle,
icon: icon,
capabilities: [],
manifest: {
name: browser.contentTitle,
launch_path: browser.currentURI.spec,
icons: {
"64": icon
}
}
}
};
}
this._application = aApplication;
this._manifest = aManifest;
this._dialog = importDialog(window, "chrome://browser/content/webapps.xul", null);
if (aApplication.title)
document.getElementById("webapps-title").value = aApplication.title;
if (aApplication.iconURI)
document.getElementById("webapps-icon").src = aApplication.iconURI;
if (aManifest.name)
document.getElementById("webapps-title").value = aManifest.name;
if (aManifest.icon)
document.getElementById("webapps-icon").src = aManifest.icon;
let uri = Services.io.newURI(aApplication.appURI, null, null);
let uri = Services.io.newURI(aManifest.uri, null, null);
let perms = [["offline", "offline-app"], ["geoloc", "geo"], ["notifications", "desktop-notification"]];
let self = this;
@ -1828,7 +1729,7 @@ var WebappsUI = {
let elem = document.getElementById("webapps-" + tuple[0] + "-checkbox");
let currentPerm = Services.perms.testExactPermission(uri, tuple[1]);
self._perms[tuple[1]] = (currentPerm == Ci.nsIPermissionManager.ALLOW_ACTION);
if ((aApplication.capabilities && (aApplication.capabilities.indexOf(tuple[1]) != -1)) || (currentPerm == Ci.nsIPermissionManager.ALLOW_ACTION))
if ((aManifest.capabilities && (aManifest.capabilities.indexOf(tuple[1]) != -1)) || (currentPerm == Ci.nsIPermissionManager.ALLOW_ACTION))
elem.checked = true;
else
elem.checked = (currentPerm == Ci.nsIPermissionManager.ALLOW_ACTION);
@ -1846,18 +1747,11 @@ var WebappsUI = {
this._dialog.close();
this._dialog = null;
BrowserUI.popPopup(this);
if (this._openwebapps) {
let browser = this._openwebapps;
browser.messageManager.sendAsyncMessage("OpenWebapps:InstallAborted", { callbackID: this._application.callbackID });
}
this._openwebapps = null;
},
_updatePermission: function updatePermission(aId, aPerm) {
try {
let uri = Services.io.newURI(this._application.appURI, null, null);
let uri = Services.io.newURI(this._manifest.uri, null, null);
let currentState = document.getElementById(aId).checked;
if (currentState != this._perms[aPerm])
Services.perms.add(uri, aPerm, currentState ? Ci.nsIPermissionManager.ALLOW_ACTION : Ci.nsIPermissionManager.DENY_ACTION);
@ -1871,19 +1765,12 @@ var WebappsUI = {
if (!title)
return;
this._application.title = title;
this._updatePermission("webapps-offline-checkbox", "offline-app");
this._updatePermission("webapps-geoloc-checkbox", "geo");
this._updatePermission("webapps-notifications-checkbox", "desktop-notification");
let browser = this._openwebapps;
this._openwebapps = null;
this.hide();
this.install();
if (browser != null)
browser.messageManager.sendAsyncMessage("OpenWebapps:InstallDone", { callbackID: this._application.callbackID });
this.install(this._manifest.uri, title, this._manifest.icon);
},
updateWebappsInstall: function updateWebappsInstall(aNode) {
@ -1892,10 +1779,11 @@ var WebappsUI = {
let browser = Browser.selectedBrowser;
return !(OpenWebapps.amInstalled(browser.currentURI.spec));
let webapp = Cc["@mozilla.org/webapps/support;1"].getService(Ci.nsIWebappsSupport);
return !(webapp && webapp.isApplicationInstalled(browser.currentURI.spec));
},
install: function(aIconURI) {
install: function(aURI, aTitle, aIcon) {
const kIconSize = 64;
let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
@ -1907,20 +1795,19 @@ var WebappsUI = {
canvas.width = canvas.height = kIconSize; // clears the canvas
let ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0, kIconSize, kIconSize);
self._application.iconData = canvas.toDataURL("image/png", "");
let data = canvas.toDataURL("image/png", "");
canvas = null;
try {
OpenWebapps.install(self._application);
let webapp = Cc["@mozilla.org/webapps/support;1"].getService(Ci.nsIWebappsSupport);
webapp.installApplication(aTitle, aURI, aIcon, data);
} catch(e) {
Cu.reportError(e);
}
}
image.onerror = function() {
// can't load the icon (bad URI) : fallback to the default one from chrome
self.install("chrome://browser/skin/images/favicon-default-30.png");
self.install(aURI, aTitle, "chrome://browser/skin/images/favicon-default-30.png");
}
image.src = aIconURI || this._application.iconURI;
image.src = aIcon;
}
};

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

@ -1523,174 +1523,3 @@ var SelectionHandler = {
};
SelectionHandler.init();
// Implementation of https://developer.mozilla.org/en/OpenWebApps/The_JavaScript_API
let OpenWebapps = {
_callbacks: [],
/** from https://developer.mozilla.org/en/OpenWebApps/The_Manifest
* only the name property is mandatory
*/
checkManifest: function(aManifest) {
return ("name" in aManifest);
},
getCallbackId: function(aCallback) {
let id = "id" + Math.random();
this._callbacks[id] = aCallback;
return id;
},
getCallback: function(aId) {
return this._callbacks[aId];
},
removeCallback: function(aId) {
delete this._callbacks[aId];
},
install: function(aStoreURI, aManifestURI, aInstallData, aSuccessCallback, aErrorCallback) {
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", aManifestURI, true);
xhr.onload = function() {
if (xhr.status == 200) {
try {
let manifest = JSON.parse(xhr.responseText);
if (!OpenWebapps.checkManifest(manifest)) {
if (aErrorCallback)
aErrorCallback({ code: "invalidManifest", message: "Invalid manifest" });
} else {
sendAsyncMessage("OpenWebapps:Install", { storeURI: aStoreURI.href, manifestURI: aManifestURI, manifest: xhr.responseText,
installData: aInstallData, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
}
} catch(e) {
if (aErrorCallback)
aErrorCallback({ code: "manifestParseError", message: "Unable to parse the manifest" });
}
}
else if (aErrorCallback) {
aErrorCallback({ code: "networkError", message: "Unable to retrieve manifest" });
}
}
xhr.onerror = function() {
if (aErrorCallback)
aErrorCallback({ code: "networkError", message: "Unable to retrieve manifest" });
}
xhr.send(null);
},
amInstalled: function(aAppURI, aSuccessCallback, aErrorCallback) {
sendAsyncMessage("OpenWebapps:AmInstalled", { appURI: aAppURI, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
},
getInstalledBy: function(aStoreURI, aSuccessCallback, aErrorCallback) {
sendAsyncMessage("OpenWebapps:GetInstalledBy", { storeURI: aStoreURI.href, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
},
mgmtLaunch: function(aOrigin, aSuccessCallback, aErrorCallback) {
sendAsyncMessage("OpenWebapps:MgmtLaunch", { origin: aOrigin, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
},
mgmtList: function(aSuccessCallback, aErrorCallback) {
sendAsyncMessage("OpenWebapps:MgmtList", { callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
},
mgmtUninstall: function(aOrigin, aSuccessCallback, aErrorCallback) {
sendAsyncMessage("OpenWebapps:MgmtUninstall", { origin: aOrigin, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
},
receiveMessage: function(aMessage) {
let msg = aMessage.json;
let callbacks = OpenWebapps.getCallback(msg.callbackID);
switch(aMessage.name) {
case "OpenWebapps:InstallAborted" :
if (callbacks.error)
callbacks.error({ code: "denied", message: "User denied installation" });
break;
case "OpenWebapps:InstallDone" :
callbacks.success();
break;
case "OpenWebapps:GetInstalledBy:Return":
callbacks.success(msg.apps);
break;
case "OpenWebapps:AmInstalled:Return":
callbacks.success(msg.installed ? msg.app : null);
break;
case "OpenWebapps:MgmtLaunch:Return":
if (msg.ok && callbacks.success)
callbacks.success();
else if (!msg.ok && callbacks.error)
callbacks.error({ code: "noSuchApp", message: "Unable to launch application"});
break;
case "OpenWebapps:MgmtList:Return":
if (msg.ok && callbacks.success)
callbacks.success(msg.apps);
else if (!msg.ok && callbacks.error)
callbacks.error({ code: "noAppList", message: "Unable to get application list"});
break;
case "OpenWebapps:MgmtUninstall:Return":
if (msg.ok && callbacks.success)
callbacks.success();
else if (!msg.ok && callbacks.error)
callbacks.error({ code: "noSuchApp", message: "Unable to uninstall application"});
break;
}
OpenWebapps.removeCallback(msg.callbackID);
},
init: function() {
addMessageListener("OpenWebapps:InstallDone", this);
addMessageListener("OpenWebapps:InstallAborted", this);
addMessageListener("OpenWebapps:GetInstalledBy:Return", this);
addMessageListener("OpenWebapps:AmInstalled:Return", this);
addMessageListener("OpenWebapps:MgmtLaunch:Return", this);
addMessageListener("OpenWebapps:MgmtList:Return", this);
addMessageListener("OpenWebapps:MgmtUninstall:Return", this);
Services.obs.addObserver(this, "content-document-global-created", false);
},
getInjected: function() {
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", "chrome://browser/content/injected.js", false);
xhr.overrideMimeType("text/plain");
xhr.send(null);
return xhr.responseText;
},
observe: function(subject, topic, data) {
let sandbox = new Components.utils.Sandbox(Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal));
sandbox.window = subject.wrappedJSObject;
sandbox.importFunction(function(aStoreURI, aManifestURI, aInstallData, aSuccessCallback, aErrorCallback) {
OpenWebapps.install(aStoreURI, aManifestURI, aInstallData, aSuccessCallback, aErrorCallback);
}, "OpenWebapps_install");
sandbox.importFunction(function(aAppURI, aSuccessCallback, aErrorCallback) {
OpenWebapps.amInstalled(aAppURI, aSuccessCallback, aErrorCallback);
}, "OpenWebapps_amInstalled");
sandbox.importFunction(function(aStoreURI, aSuccessCallback, aErrorCallback) {
OpenWebapps.getInstalledBy(aStoreURI, aSuccessCallback, aErrorCallback);
}, "OpenWebapps_getInstalledBy");
sandbox.importFunction(function(aOrigin, aSuccessCallback, aErrorCallback) {
OpenWebapps.mgmtLaunch(aOrigin, aSuccessCallback, aErrorCallback);
}, "OpenWebappsMgmt_launch");
sandbox.importFunction(function(aSuccessCallback, aErrorCallback) {
OpenWebapps.mgmtList(aSuccessCallback, aErrorCallback);
}, "OpenWebappsMgmt_list");
sandbox.importFunction(function(aOrigin, aSuccessCallback, aErrorCallback) {
OpenWebapps.mgmtUninstall(aOrigin, aSuccessCallback, aErrorCallback);
}, "OpenWebappsMgmt_uninstall");
let toInject = OpenWebapps.getInjected();
Cu.evalInSandbox(toInject, sandbox, "1.8", "chrome://browser/content/injected.js", 1);
}
};
OpenWebapps.init();

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

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<!DOCTYPE dialog [
<!ENTITY % dialog SYSTEM "chrome://browser/locale/prompt.dtd">
<!ENTITY % changempDTD SYSTEM "chrome://mozapps/locale/preferences/changemp.dtd" >
%dialog;
%changempDTD;
]>
<dialog id="masterpassword-change" title="&setPassword.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="MasterPasswordUI.setPassword();"/>
<command id="cmd_cancel" oncommand="MasterPasswordUI.hide();"/>
</commandset>
<vbox class="prompt-header" flex="1">
<description id="masterpassword-title" class="prompt-title" crop="center" flex="1">&setPassword.title;</description>
<separator id="prompt-confirm-separator" class="prompt-line"/>
</vbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<label control="masterpassword-newpassword1" value="&setPassword.newPassword.label;"/>
<textbox id="masterpassword-newpassword1" type="password" oninput="MasterPasswordUI.checkPassword();" flex="1"/>
<label control="masterpassword-newpassword2" value="&setPassword.reenterPassword.label;"/>
<textbox id="masterpassword-newpassword2" type="password" oninput="MasterPasswordUI.checkPassword();" flex="1"/>
<separator/>
</scrollbox>
<hbox class="prompt-buttons">
<button class="prompt-button" label="&ok.label;" command="cmd_ok"/>
<button class="prompt-button" label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

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

@ -101,6 +101,8 @@ var PreferencesView = {
this._loadLocales();
this._loadHomePage();
MasterPasswordUI.updatePreference();
},
_loadLocales: function _loadLocales() {

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

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!DOCTYPE dialog [
<!ENTITY % dialog SYSTEM "chrome://browser/locale/prompt.dtd">
<!ENTITY % removempDTD SYSTEM "chrome://mozapps/locale/preferences/removemp.dtd" >
%dialog;
%removempDTD;
]>
<dialog id="masterpassword-remove" title="&removePassword.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="MasterPasswordUI.removePassword();"/>
<command id="cmd_cancel" oncommand="MasterPasswordUI.hide();"/>
</commandset>
<vbox class="prompt-header" flex="1">
<description id="masterpassword-title" class="prompt-title" crop="center" flex="1">&removePassword.title;</description>
<separator id="prompt-confirm-separator" class="prompt-line"/>
</vbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<label control="masterpassword-oldpassword" value="&setPassword.oldPassword.label;"/>
<textbox id="masterpassword-oldpassword" type="password" oninput="MasterPasswordUI.checkOldPassword();" flex="1"/>
<separator/>
</scrollbox>
<hbox class="prompt-buttons">
<button class="prompt-button" label="&ok.label;" disabled="true" command="cmd_ok"/>
<button class="prompt-button" label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

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

@ -31,6 +31,7 @@ chrome.jar:
content/SelectHelperUI.js (content/SelectHelperUI.js)
content/SharingUI.js (content/SharingUI.js)
content/TabsPopup.js (content/TabsPopup.js)
content/MasterPasswordUI.js (content/MasterPasswordUI.js)
* content/content.js (content/content.js)
content/commandUtil.js (content/commandUtil.js)
* content/bindings.xml (content/bindings.xml)
@ -65,6 +66,8 @@ chrome.jar:
content/prompt/prompt.js (content/prompt/prompt.js)
content/share.xul (content/share.xul)
content/webapps.xul (content/webapps.xul)
content/masterPassword.xul (content/masterPassword.xul)
content/removeMasterPassword.xul (content/removeMasterPassword.xul)
content/AnimatedZoom.js (content/AnimatedZoom.js)
#ifdef MOZ_SERVICES_SYNC
content/sync.js (content/sync.js)
@ -73,7 +76,6 @@ chrome.jar:
content/fullscreen-video.js (content/fullscreen-video.js)
content/fullscreen-video.xhtml (content/fullscreen-video.xhtml)
content/netError.xhtml (content/netError.xhtml)
content/injected.js (content/injected.js)
% override chrome://global/content/config.xul chrome://browser/content/config.xul
% override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml

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

@ -49,6 +49,7 @@ XPIDL_MODULE = MobileComponents
XPIDLSRCS = \
SessionStore.idl \
LoginManagerPrompter.idl \
WebappsSupport.idl \
$(NULL)
EXTRA_PP_COMPONENTS = \
@ -75,6 +76,7 @@ EXTRA_COMPONENTS = \
LoginManager.js \
LoginManagerPrompter.js \
BlocklistPrompt.js \
WebappsSupport.js \
$(NULL)
ifdef MOZ_SAFE_BROWSING

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

@ -120,3 +120,7 @@ category app-startup SafeBrowsing service,@mozilla.org/safebrowsing/application;
component {88b3eb21-d072-4e3b-886d-f89d8c49fe59} UpdatePrompt.js
contract @mozilla.org/updates/update-prompt;1 {88b3eb21-d072-4e3b-886d-f89d8c49fe59}
#endif
# webapps
component {cb1107c1-1e15-4f11-99c8-27b9ec221a2a} WebappsSupport.js
contract @mozilla.org/webapps/support;1 {cb1107c1-1e15-4f11-99c8-27b9ec221a2a}

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

@ -1,4 +1,5 @@
/* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -11,10 +12,10 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Mobile Browser.
* The Original Code is Mozilla Webapp code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@ -34,33 +35,26 @@
*
* ***** END LICENSE BLOCK ***** */
/* Expose API under window.navigator.apps */
if (window && window.navigator) {
window.navigator.mozApps = {
install: function(aParam) {
return OpenWebapps_install(window.location, aParam.url, aParam.install_data, aParam.onsuccess, aParam.onerror);
},
amInstalled: function(aSuccessCallback, aErrorCallback) {
return OpenWebapps_amInstalled(window.location, aSuccessCallback, aErrorCallback);
},
getInstalledBy: function(aSuccessCallback, aErrorCallback) {
return OpenWebapps_getInstalledBy(window.location, aSuccessCallback, aErrorCallback);
}
}
#include "nsISupports.idl"
[scriptable, uuid(adb91273-0cf1-4bbe-a37b-22e660192e2a)]
interface nsIWebappsSupport : nsISupports
{
/**
* This method installs a web app.
*
* @param title the user-friendly name of the application.
* @param uri the uri of the web app.
* @param iconData a base64 encoded representation of the application's icon.
*/
void installApplication(in wstring title, in wstring uri, in wstring iconUri, in wstring iconData);
window.navigator.mozApps.mgmt = {
launch: function(aOrigin, aSuccessCallback, aErrorCallback) {
return OpenWebappsMgmt_launch(aOrigin, aSuccessCallback, aErrorCallback);
},
list: function(aSuccessCallback, aErrorCallback) {
return OpenWebappsMgmt_list(aSuccessCallback, aErrorCallback);
},
uninstall: function(aOrigin, aSuccessCallback, aErrorCallback) {
return OpenWebappsMgmt_uninstall(aOrigin, aSuccessCallback, aErrorCallback);
}
}
}
/**
* Checks is a web app is already installed
*
* @param uri the uri of the web app
* @return true if the web app is installed, false if it's not installed
*/
boolean isApplicationInstalled(in wstring uri);
};

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

@ -0,0 +1,125 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabrice Desré <fabrice@mozilla.com>
* Mark Finkle <mfinkle@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const DB_VERSION = 1;
function WebappsSupport() {
this.init();
}
WebappsSupport.prototype = {
db: null,
init: function() {
let file = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
file.append("webapps.sqlite");
this.db = Services.storage.openDatabase(file);
let version = this.db.schemaVersion;
if (version == 0) {
this.db.executeSimpleSQL("CREATE TABLE webapps (title TEXT, uri TEXT PRIMARY KEY, icon TEXT)");
this.db.schemaVersion = DB_VERSION;
}
XPCOMUtils.defineLazyGetter(this, "_installQuery", function() {
return this.db.createAsyncStatement("INSERT INTO webapps (title, uri, icon) VALUES(:title, :uri, :icon)");
});
XPCOMUtils.defineLazyGetter(this, "_findQuery", function() {
return this.db.createStatement("SELECT uri FROM webapps where uri = :uri");
});
Services.obs.addObserver(this, "quit-application-granted", false);
},
// entry point
installApplication: function(aTitle, aURI, aIconURI, aIconData) {
let stmt = this._installQuery;
stmt.params.title = aTitle;
stmt.params.uri = aURI;
stmt.params.icon = aIconData;
stmt.executeAsync();
},
isApplicationInstalled: function(aURI) {
let stmt = this._findQuery;
let found = false;
try {
stmt.params.uri = aURI;
found = stmt.executeStep();
} finally {
stmt.reset();
}
return found;
},
// nsIObserver
observe: function(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, "quit-application-granted");
// Finalize the statements that we have used
let stmts = [
"_installQuery",
"_findQuery"
];
for (let i = 0; i < stmts.length; i++) {
// We do not want to create any query we haven't already created, so
// see if it is a getter first.
if (Object.getOwnPropertyDescriptor(this, stmts[i]).value !== undefined) {
this[stmts[i]].finalize();
}
}
this.db.asyncClose();
},
// QI
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebappsSupport]),
// XPCOMUtils factory
classID: Components.ID("{cb1107c1-1e15-4f11-99c8-27b9ec221a2a}")
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([WebappsSupport]);

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

@ -612,6 +612,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
#ifdef MOZ_UPDATER
@BINPATH@/components/UpdatePrompt.js
#endif
@BINPATH@/components/WebappsSupport.js
@BINPATH@/components/XPIDialogService.js
@BINPATH@/components/browsercomps.xpt
@BINPATH@/extensions/feedback@mobile.mozilla.org.xpi

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

@ -8,6 +8,7 @@
<!ENTITY privacy.title "Privacy &amp; Security">
<!ENTITY allowCookies.title "Allow cookies">
<!ENTITY doNotTrack.title "Tell sites not to track me">
<!ENTITY masterPassword.title "Use master password">
<!ENTITY clearPrivateData2.title "Clear private data">
<!ENTITY clearPrivateData.button "Clear">
<!ENTITY rememberPasswords.title "Remember passwords">

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

@ -46,7 +46,6 @@ EXTRA_JS_MODULES = \
LocaleRepository.jsm \
linuxTypes.jsm \
video.jsm \
openWebapps.jsm \
$(NULL)
EXTRA_PP_JS_MODULES = \

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

@ -1,209 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabrice Desré <fabrice@mozilla.com>
* Mark Finkle <mfinkle@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
let EXPORTED_SYMBOLS = ["OpenWebapps"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
Cu.import("resource://gre/modules/NetUtil.jsm");
return NetUtil;
});
let OpenWebapps = {
appsDir: null,
appsFile: null,
webapps: { },
init: function() {
let file = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
file.append("webapps");
if (!file.exists() || !file.isDirectory()) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
}
this.appsDir = file;
this.appsFile = file.clone();
this.appsFile.append("webapps.json");
if (!this.appsFile.exists())
return;
try {
let channel = NetUtil.newChannel(this.appsFile);
channel.contentType = "application/json";
let self = this;
NetUtil.asyncFetch(channel, function(aStream, aResult) {
if (!Components.isSuccessCode(aResult)) {
Cu.reportError("OpenWebappsSupport: Could not read from webapps.json file");
return;
}
// Read webapps json file into a string
let data = null;
try {
data = JSON.parse(NetUtil.readInputStreamToString(aStream, aStream.available()) || "");
self.webapps = data;
aStream.close();
} catch (ex) {
Cu.reportError("OpenWebsappsStore: Could not parse JSON: " + ex);
}
});
} catch (ex) {
Cu.reportError("OpenWebappsSupport: Could not read from webapps.json file: " + ex);
}
},
_writeFile: function ss_writeFile(aFile, aData) {
// Initialize the file output stream.
let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, ostream.DEFER_OPEN);
// Obtain a converter to convert our data to a UTF-8 encoded input stream.
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
// Asynchronously copy the data to the file.
let istream = converter.convertToInputStream(aData);
NetUtil.asyncCopy(istream, ostream, function(rc) {
// nothing to do
});
},
install: function(aApplication) {
// Don't install twice an application
if (this.amInstalled(aApplication.appURI))
return;
let uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
let id = uuidGenerator.generateUUID().toString();
let dir = this.appsDir.clone();
dir.append(id);
dir.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
let manFile = dir.clone();
manFile.append("manifest.json");
this._writeFile(manFile, JSON.stringify(aApplication.manifest));
this.webapps[id] = {
title: aApplication.title,
storeURI: aApplication.storeURI,
appURI: aApplication.appURI,
iconData: aApplication.iconData,
installData: aApplication.installData,
installTime: (new Date()).getTime(),
manifest: aApplication.manifest
};
this._writeFile(this.appsFile, JSON.stringify(this.webapps));
},
amInstalled: function(aURI) {
for (let id in this.webapps) {
let app = this.webapps[id];
if (app.appURI == aURI) {
return { origin: app.appURI,
install_origin: app.storeURI,
install_data: app.installData,
install_time: app.installTime,
manifest: app.manifest };
}
}
return null;
},
getInstalledBy: function(aStoreURI) {
let res = [];
for (let id in this.webapps) {
let app = this.webapps[id];
if (app.storeURI == aStoreURI)
res.push({ origin: app.appURI,
install_origin: app.storeURI,
install_data: app.installData,
install_time: app.installTime,
manifest: app.manifest });
}
return res;
},
mgmtList: function() {
let res = {};
for (let id in this.webapps) {
let app = this.webapps[id];
res[app.appURI] = { origin: app.appURI,
install_origin: app.storeURI,
install_data: app.installData,
install_time: app.installTime,
manifest: app.manifest };
}
return res;
},
mgmtLaunch: function(aOrigin) {
for (let id in this.webapps) {
let app = this.webapps[id];
if (app.appURI == aOrigin) {
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
browserWin.browserDOMWindow.openURI(Services.io.newURI(aOrigin, null, null), null, browserWin.OPEN_APPTAB, Ci.nsIBrowserDOMWindow.OPEN_NEW);
return true;
}
}
return false;
},
mgmtUninstall: function(aOrigin) {
for (let id in this.webapps) {
let app = this.webapps[id];
if (app.appURI == aOrigin) {
delete this.webapps[id];
this._writeFile(this.appsFile, JSON.stringify(this.webapps));
let dir = this.appsFile.clone();
dir.append(id);
try {
dir.remove(true);
} catch (e) {
}
return true;
}
}
return false;
}
};
OpenWebapps.init();

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

@ -47,7 +47,7 @@
*
* The nsIURL methods operate on the <jar-entry> part of the spec.
*/
[scriptable, uuid(c95d481a-c0ec-43cc-8320-43842b1df597)]
[scriptable, uuid(0d31634e-2fc9-4597-9d53-11fb3f05516a)]
interface nsIJARURI : nsIURL {
/**

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

@ -247,6 +247,20 @@ nsJARURI::GetSpec(nsACString &aSpec)
return FormatSpec(entrySpec, aSpec);
}
NS_IMETHODIMP
nsJARURI::GetSpecIgnoringRef(nsACString &aSpec)
{
nsCAutoString entrySpec;
mJAREntry->GetSpecIgnoringRef(entrySpec);
return FormatSpec(entrySpec, aSpec);
}
NS_IMETHODIMP
nsJARURI::GetHasRef(PRBool *result)
{
return mJAREntry->GetHasRef(result);
}
NS_IMETHODIMP
nsJARURI::SetSpec(const nsACString& aSpec)
{

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

@ -73,7 +73,7 @@
* Description: The mime type we want an icon for. This is ignored by stock images.
*/
[scriptable, uuid(b6a47fa0-2f1e-4084-ae5f-bdebab4d1cc3)]
[scriptable, uuid(da53adda-cbe3-41bc-a57d-fdd7a0ff448b)]
interface nsIMozIconURI : nsIURI
{
/**

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

@ -145,6 +145,19 @@ nsMozIconURI::GetSpec(nsACString &aSpec)
return NS_OK;
}
NS_IMETHODIMP
nsMozIconURI::GetSpecIgnoringRef(nsACString &result)
{
return GetSpec(result);
}
NS_IMETHODIMP
nsMozIconURI::GetHasRef(PRBool *result)
{
*result = PR_FALSE;
return NS_OK;
}
// takes a string like ?size=32&contentType=text/html and returns a new string
// containing just the attribute value. i.e you could pass in this string with
// an attribute name of 'size=', this will return 32

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

@ -45,7 +45,7 @@ interface nsIFile;
* an URL. The URL scheme need not be file:, since other local protocols may
* map URLs to files (e.g., resource:).
*/
[scriptable, uuid(44c14c16-07b4-48fb-b44b-0c8986697a17)]
[scriptable, uuid(93a4f94e-1dae-4056-ac4e-08e13691ee8e)]
interface nsIFileURL : nsIURL
{
/**

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

@ -101,7 +101,7 @@
* we will need to add additional checks there for all intermediate IIDs, until
* nsPrincipal is fixed to serialize its URIs as nsISupports (bug 662693).
*/
[scriptable, uuid(12120b20-0929-40e9-88cf-6e08766e8b23)]
[scriptable, uuid(395fe045-7d18-4adb-a3fd-af98c8a1af11)]
interface nsIURI : nsISupports
{
/************************************************************************
@ -272,4 +272,13 @@ interface nsIURI : nsISupports
*/
nsIURI cloneIgnoringRef();
/**
* returns a string for the current URI with the ref element cleared.
*/
readonly attribute AUTF8String specIgnoringRef;
/**
* Returns if there is a reference portion (the part after the "#") of the URI.
*/
readonly attribute boolean hasRef;
};

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

@ -54,7 +54,7 @@
* |
* filePath
*/
[scriptable, uuid(eab18ad5-e3be-4eb3-9c78-7d4e750200d6)]
[scriptable, uuid(067d697a-c725-4293-9656-e658a75e6bcf)]
interface nsIURL : nsIURI
{
/*************************************************************************

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

@ -201,6 +201,21 @@ nsSimpleURI::GetSpec(nsACString &result)
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsSimpleURI::GetSpecIgnoringRef(nsACString &result)
{
result = mScheme + NS_LITERAL_CSTRING(":") + mPath;
return NS_OK;
}
NS_IMETHODIMP
nsSimpleURI::GetHasRef(PRBool *result)
{
*result = mIsRefValid;
return NS_OK;
}
NS_IMETHODIMP
nsSimpleURI::SetSpec(const nsACString &aSpec)
{

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

@ -999,6 +999,21 @@ nsStandardURL::GetSpec(nsACString &result)
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsStandardURL::GetSpecIgnoringRef(nsACString &result)
{
// URI without ref is 0 to one char before ref
if (mRef.mLen >= 0) {
URLSegment noRef(0, mRef.mPos - 1);
result = Segment(noRef);
} else {
result = mSpec;
}
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsStandardURL::GetPrePath(nsACString &result)
@ -2144,6 +2159,13 @@ nsStandardURL::GetRef(nsACString &result)
return NS_OK;
}
NS_IMETHODIMP
nsStandardURL::GetHasRef(PRBool *result)
{
*result = (mRef.mLen >= 0);
return NS_OK;
}
// result may contain unescaped UTF-8 characters
NS_IMETHODIMP
nsStandardURL::GetDirectory(nsACString &result)

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

@ -306,6 +306,8 @@ var gTests = [
prePath: "http://a",
path: "/b/c/g?y",
ref: "",// fix
specIgnoringRef: "http://a/b/c/g?y",
hasRef: false,
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "#s",
@ -313,6 +315,8 @@ var gTests = [
prePath: "http://a",
path: "/b/c/d;p?q#s",
ref: "s",// fix
specIgnoringRef: "http://a/b/c/d;p?q",
hasRef: true,
nsIURL: true, nsINestedURI: false },
{ spec: "http://a/b/c/d;p?q",
relativeURI: "g#s",
@ -688,6 +692,11 @@ function do_test_uri_basic(aTest) {
do_check_property(aTest, URI, "username");
do_check_property(aTest, URI, "password");
do_check_property(aTest, URI, "host");
do_check_property(aTest, URI, "specIgnoringRef");
if ("hasRef" in aTest) {
do_info("testing hasref: " + aTest.hasRef + " vs " + URI.hasRef);
do_check_eq(aTest.hasRef, URI.hasRef);
}
}
// Test that a given URI parses correctly when we add a given ref to the end
@ -728,6 +737,8 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) {
" is equalExceptRef to self with '" + aSuffix + "' appended");
do_check_uri_eqExceptRef(origURI, testURI);
do_check_eq(testURI.hasRef, true);
if (!origURI.ref) {
// These tests fail if origURI has a ref
do_info("testing cloneIgnoringRef on " + testURI.spec +

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

@ -1 +1 @@
http://hg.mozilla.org/projects/addon-sdk/archive/cfcf0515ae75.tar.bz2
http://hg.mozilla.org/projects/addon-sdk/archive/9f45975c909d.tar.bz2

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

@ -247,6 +247,15 @@ function populateGraphicsSection() {
pushInfoRow(trGraphics, "driverDate", gfxInfo.adapterDriverDate);
#ifdef XP_WIN
pushInfoRow(trGraphics, "adapterDescription2", gfxInfo.adapterDescription2);
pushInfoRow(trGraphics, "adapterVendorID2", hexValueToString(gfxInfo.adapterVendorID2));
pushInfoRow(trGraphics, "adapterDeviceID2", hexValueToString(gfxInfo.adapterDeviceID2));
pushInfoRow(trGraphics, "adapterRAM2", gfxInfo.adapterRAM2);
pushInfoRow(trGraphics, "adapterDrivers2", gfxInfo.adapterDriver2);
pushInfoRow(trGraphics, "driverVersion2", gfxInfo.adapterDriverVersion2);
pushInfoRow(trGraphics, "driverDate2", gfxInfo.adapterDriverDate2);
pushInfoRow(trGraphics, "isGPU2Active", gfxInfo.isGPU2Active);
var version = Cc["@mozilla.org/system-info;1"]
.getService(Ci.nsIPropertyBag2)
.getProperty("version");

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

@ -31,4 +31,12 @@ adapterDrivers = Adapter Drivers
adapterRAM = Adapter RAM
driverVersion = Driver Version
driverDate = Driver Date
adapterDescription2 = Adapter Description (GPU #2)
adapterVendorID2 = Vendor ID (GPU #2)
adapterDeviceID2 = Device ID (GPU #2)
adapterDrivers2 = Adapter Drivers (GPU #2)
adapterRAM2 = Adapter RAM (GPU #2)
driverVersion2 = Driver Version (GPU #2)
driverDate2 = Driver Date (GPU #2)
isGPU2Active = GPU #2 Active
webglRenderer = WebGL Renderer

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

@ -51,27 +51,38 @@ interface nsIGfxInfo : nsISupports
readonly attribute boolean AzureEnabled;
readonly attribute DOMString DWriteVersion;
readonly attribute DOMString cleartypeParameters;
// XXX: Switch to a list of devices, rather than explicitly numbering them.
/**
* The name of the display adapter.
*/
readonly attribute DOMString adapterDescription;
readonly attribute DOMString adapterDescription2;
readonly attribute DOMString adapterDriver;
readonly attribute DOMString adapterDriver2;
/* These types are inspired by DXGI_ADAPTER_DESC */
readonly attribute unsigned long adapterVendorID;
readonly attribute unsigned long adapterVendorID2;
readonly attribute unsigned long adapterDeviceID;
readonly attribute unsigned long adapterDeviceID2;
/**
* The amount of RAM in MB in the display adapter.
*/
readonly attribute DOMString adapterRAM;
readonly attribute DOMString adapterRAM2;
readonly attribute DOMString adapterDriverVersion;
readonly attribute DOMString adapterDriverVersion2;
readonly attribute DOMString adapterDriverDate;
readonly attribute DOMString adapterDriverDate2;
readonly attribute boolean isGPU2Active;
void getFailures(
[optional] out unsigned long failureCount,

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

@ -148,6 +148,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
jGetSystemColors = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getSystemColors", "()[I");
jGetIconForExtension = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getIconForExtension", "(Ljava/lang/String;I)[B");
jCreateShortcut = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "createShortcut", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
jGetShowPasswordSetting = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getShowPasswordSetting", "()Z");
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
@ -755,6 +756,13 @@ AndroidBridge::GetIconForExtension(const nsACString& aFileExt, PRUint32 aIconSiz
mJNIEnv->ReleaseByteArrayElements(arr, elements, 0);
}
bool
AndroidBridge::GetShowPasswordSetting()
{
ALOG_BRIDGE("AndroidBridge::GetShowPasswordSetting");
return mJNIEnv->CallStaticBooleanMethod(mGeckoAppShellClass, jGetShowPasswordSetting);
}
void
AndroidBridge::SetSurfaceView(jobject obj)
{
@ -998,4 +1006,3 @@ AndroidBridge::UnlockBitmap(jobject bitmap)
if ((err = AndroidBitmap_unlockPixels(JNI(), bitmap)) != 0)
ALOG_BRIDGE("AndroidBitmap_unlockPixels failed! (error %d)", err);
}

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

@ -212,6 +212,8 @@ public:
void GetIconForExtension(const nsACString& aFileExt, PRUint32 aIconSize, PRUint8 * const aBuf);
bool GetShowPasswordSetting();
struct AutoLocalJNIFrame {
AutoLocalJNIFrame(int nEntries = 128) : mEntries(nEntries) {
// Make sure there is enough space to store a local ref to the
@ -322,6 +324,7 @@ protected:
jmethodID jGetSystemColors;
jmethodID jGetIconForExtension;
jmethodID jCreateShortcut;
jmethodID jGetShowPasswordSetting;
// stuff we need for CallEglCreateWindowSurface
jclass jEGLSurfaceImplClass;

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

@ -111,6 +111,13 @@ GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
return NS_OK;
}
/* readonly attribute DOMString adapterDescription2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterRAM; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
@ -119,6 +126,13 @@ GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
return NS_OK;
}
/* readonly attribute DOMString adapterRAM2; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriver; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
@ -127,6 +141,13 @@ GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
return NS_OK;
}
/* readonly attribute DOMString adapterDriver2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverVersion; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
@ -135,6 +156,13 @@ GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverVersion2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverDate; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
@ -143,6 +171,13 @@ GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverDate2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
@ -151,6 +186,13 @@ GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
@ -159,6 +201,20 @@ GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute boolean isGPU2Active; */
NS_IMETHODIMP
GfxInfo::GetIsGPU2Active(PRBool* aIsGPU2Active)
{
return NS_ERROR_FAILURE;
}
void
GfxInfo::AddCrashReportAnnotations()
{

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

@ -64,6 +64,14 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(PRBool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;

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

@ -45,9 +45,12 @@
using namespace mozilla;
using mozilla::dom::ContentChild;
PRBool nsLookAndFeel::mInitialized = PR_FALSE;
PRBool nsLookAndFeel::mInitializedSystemColors = PR_FALSE;
AndroidSystemColors nsLookAndFeel::mSystemColors;
PRBool nsLookAndFeel::mInitializedShowPassword = PR_FALSE;
PRBool nsLookAndFeel::mShowPassword = PR_TRUE;
nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel()
{
@ -68,7 +71,7 @@ nsLookAndFeel::~nsLookAndFeel()
nsresult
nsLookAndFeel::GetSystemColors()
{
if (mInitialized)
if (mInitializedSystemColors)
return NS_OK;
if (!AndroidBridge::Bridge())
@ -76,7 +79,7 @@ nsLookAndFeel::GetSystemColors()
AndroidBridge::Bridge()->GetSystemColors(&mSystemColors);
mInitialized = PR_TRUE;
mInitializedSystemColors = PR_TRUE;
return NS_OK;
}
@ -102,7 +105,7 @@ nsLookAndFeel::CallRemoteGetSystemColors()
// so just copy the memory block
memcpy(&mSystemColors, colors.Elements(), sizeof(nscolor) * colorsCount);
mInitialized = PR_TRUE;
mInitializedSystemColors = PR_TRUE;
return NS_OK;
}
@ -112,7 +115,7 @@ nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
{
nsresult rv = NS_OK;
if (!mInitialized) {
if (!mInitializedSystemColors) {
if (XRE_GetProcessType() == GeckoProcessType_Default)
rv = GetSystemColors();
else
@ -460,3 +463,20 @@ nsLookAndFeel::GetMetric(const nsMetricFloatID aID,
}
return rv;
}
/*virtual*/
PRBool nsLookAndFeel::GetEchoPassword()
{
if (!mInitializedShowPassword) {
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (AndroidBridge::Bridge())
mShowPassword = AndroidBridge::Bridge()->GetShowPasswordSetting();
else
NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available!");
} else {
ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
}
mInitializedShowPassword = PR_TRUE;
}
return mShowPassword;
}

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

@ -51,10 +51,13 @@ public:
nsresult NativeGetColor(const nsColorID aID, nscolor &aColor);
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
virtual PRBool GetEchoPassword();
protected:
static PRBool mInitialized;
static PRBool mInitializedSystemColors;
static mozilla::AndroidSystemColors mSystemColors;
static PRBool mInitializedShowPassword;
static PRBool mShowPassword;
nsresult GetSystemColors();
nsresult CallRemoteGetSystemColors();

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

@ -64,6 +64,14 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(PRBool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;

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

@ -134,6 +134,13 @@ GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
return NS_OK;
}
/* readonly attribute DOMString adapterDescription2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterRAM; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
@ -142,6 +149,13 @@ GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
return NS_OK;
}
/* readonly attribute DOMString adapterRAM2; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriver; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
@ -150,6 +164,13 @@ GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
return NS_OK;
}
/* readonly attribute DOMString adapterDriver2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverVersion; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
@ -158,6 +179,13 @@ GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverVersion2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverDate; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
@ -166,6 +194,13 @@ GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverDate2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
@ -174,6 +209,13 @@ GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
@ -182,6 +224,20 @@ GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute boolean isGPU2Active; */
NS_IMETHODIMP
GfxInfo::GetIsGPU2Active(PRBool* aIsGPU2Active)
{
return NS_ERROR_FAILURE;
}
void
GfxInfo::AddCrashReportAnnotations()
{

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

@ -77,7 +77,11 @@ static const PRUint32 vendorATI = 0x1002;
GfxInfo::GfxInfo()
: mAdapterVendorID(0),
mAdapterDeviceID(0),
mWindowsVersion(0)
mAdapterVendorID2(0),
mAdapterDeviceID2(0),
mWindowsVersion(0),
mHasDualGPU(PR_FALSE),
mIsGPU2Active(PR_FALSE)
{
}
@ -199,8 +203,6 @@ GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
return NS_ERROR_FAILURE;
}
/* XXX: GfxInfo doesn't handle multiple GPUs. We should try to do that. Bug #591057 */
static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, nsAString& destString, int type)
{
HKEY key;
@ -409,7 +411,40 @@ GfxInfo::Init()
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverDate = value;
RegCloseKey(key);
RegCloseKey(key);
// Check for second adapter:
//
// A second adapter will have the same driver key as the first adapter except for
// the last character, where '1' will be swapped for '0' or vice-versa.
// We know driverKey.Length() > 0 since driverKeyPre is a prefix of driverKey.
if (driverKey[driverKey.Length()-1] == '0') {
driverKey.SetCharAt('1', driverKey.Length()-1);
} else {
driverKey.SetCharAt('0', driverKey.Length()-1);
}
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
mHasDualGPU = PR_TRUE;
mDeviceKey2 = driverKey;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDeviceString2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDeviceID2 = value;
RegCloseKey(key);
}
break;
}
}
@ -422,6 +457,43 @@ GfxInfo::Init()
FreeLibrary(setupapi);
}
nsAutoString vendor(mDeviceID);
ToUpperCase(vendor);
PRInt32 start = vendor.Find(NS_LITERAL_CSTRING("VEN_"));
if (start != -1) {
vendor.Cut(0, start + strlen("VEN_"));
vendor.Truncate(4);
}
nsresult err;
mAdapterVendorID = vendor.ToInteger(&err, 16);
vendor = mDeviceID2;
ToUpperCase(vendor);
start = vendor.Find(NS_LITERAL_CSTRING("VEN_"));
if (start != -1) {
vendor.Cut(0, start + strlen("VEN_"));
vendor.Truncate(4);
}
mAdapterVendorID2 = vendor.ToInteger(&err, 16);
nsAutoString device(mDeviceID);
ToUpperCase(device);
start = device.Find(NS_LITERAL_CSTRING("&DEV_"));
if (start != -1) {
device.Cut(0, start + strlen("&DEV_"));
device.Truncate(4);
}
mAdapterDeviceID = device.ToInteger(&err, 16);
device = mDeviceID2;
ToUpperCase(device);
start = device.Find(NS_LITERAL_CSTRING("&DEV_"));
if (start != -1) {
device.Cut(0, start + strlen("&DEV_"));
device.Truncate(4);
}
mAdapterDeviceID2 = device.ToInteger(&err, 16);
const char *spoofedDriverVersionString = PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
if (spoofedDriverVersionString) {
mDriverVersion.AssignASCII(spoofedDriverVersionString);
@ -430,16 +502,6 @@ GfxInfo::Init()
const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_VENDOR_ID");
if (spoofedVendor) {
PR_sscanf(spoofedVendor, "%x", &mAdapterVendorID);
} else {
nsAutoString vendor(mDeviceID);
ToUpperCase(vendor);
PRInt32 start = vendor.Find(NS_LITERAL_CSTRING("VEN_"));
if (start != -1) {
vendor.Cut(0, start + strlen("VEN_"));
vendor.Truncate(4);
}
nsresult err;
mAdapterVendorID = vendor.ToInteger(&err, 16);
}
mHasDriverVersionMismatch = PR_FALSE;
@ -468,16 +530,6 @@ GfxInfo::Init()
const char *spoofedDevice = PR_GetEnv("MOZ_GFX_SPOOF_DEVICE_ID");
if (spoofedDevice) {
PR_sscanf(spoofedDevice, "%x", &mAdapterDeviceID);
} else {
nsAutoString device(mDeviceID);
ToUpperCase(device);
PRInt32 start = device.Find(NS_LITERAL_CSTRING("&DEV_"));
if (start != -1) {
device.Cut(0, start + strlen("&DEV_"));
device.Truncate(4);
}
nsresult err;
mAdapterDeviceID = device.ToInteger(&err, 16);
}
const char *spoofedWindowsVersion = PR_GetEnv("MOZ_GFX_SPOOF_WINDOWS_VERSION");
@ -500,6 +552,14 @@ GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
return NS_OK;
}
/* readonly attribute DOMString adapterDescription2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
{
aAdapterDescription = mDeviceString2;
return NS_OK;
}
/* readonly attribute DOMString adapterRAM; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
@ -509,6 +569,15 @@ GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
return NS_OK;
}
/* readonly attribute DOMString adapterRAM2; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
{
if (NS_FAILED(GetKeyValue(mDeviceKey2.BeginReading(), L"HardwareInformation.MemorySize", aAdapterRAM, REG_DWORD)))
aAdapterRAM = L"Unknown";
return NS_OK;
}
/* readonly attribute DOMString adapterDriver; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
@ -518,6 +587,15 @@ GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
return NS_OK;
}
/* readonly attribute DOMString adapterDriver2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
{
if (NS_FAILED(GetKeyValue(mDeviceKey2.BeginReading(), L"InstalledDisplayDrivers", aAdapterDriver, REG_MULTI_SZ)))
aAdapterDriver = L"Unknown";
return NS_OK;
}
/* readonly attribute DOMString adapterDriverVersion; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
@ -534,6 +612,22 @@ GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverVersion2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
{
aAdapterDriverVersion = mDriverVersion2;
return NS_OK;
}
/* readonly attribute DOMString adapterDriverDate2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
{
aAdapterDriverDate = mDriverDate2;
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
@ -542,6 +636,14 @@ GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
{
*aAdapterVendorID = mAdapterVendorID2;
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
@ -550,6 +652,22 @@ GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
{
*aAdapterDeviceID = mAdapterDeviceID2;
return NS_OK;
}
/* readonly attribute boolean isGPU2Active; */
NS_IMETHODIMP
GfxInfo::GetIsGPU2Active(PRBool* aIsGPU2Active)
{
*aIsGPU2Active = mIsGPU2Active;
return NS_OK;
}
#if defined(MOZ_CRASHREPORTER)
/* Cisco's VPN software can cause corruption of the floating point state.
* Make a note of this in our crash reports so that some weird crashes
@ -607,6 +725,19 @@ GfxInfo::AddCrashReportAnnotations()
}
note.Append("\n");
if (mHasDualGPU) {
PRUint32 deviceID2, vendorID2;
nsAutoString adapterDriverVersionString2;
note.Append("Has dual GPUs. GPU #2: ");
GetAdapterDeviceID2(&deviceID2);
GetAdapterVendorID2(&vendorID2);
GetAdapterDriverVersion2(adapterDriverVersionString2);
note.AppendPrintf("AdapterVendorID2: %04x, ", vendorID2);
note.AppendPrintf("AdapterDeviceID2: %04x, ", deviceID2);
note.AppendPrintf("AdapterDriverVersion2: ");
note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
}
CrashReporter::AppendAppNotesToCrashReport(note);
#endif

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

@ -68,6 +68,14 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(PRBool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;
@ -94,7 +102,16 @@ private:
nsString mDeviceKeyDebug;
PRUint32 mAdapterVendorID;
PRUint32 mAdapterDeviceID;
nsString mDeviceString2;
nsString mDriverVersion2;
nsString mDeviceID2;
nsString mDriverDate2;
nsString mDeviceKey2;
PRUint32 mAdapterVendorID2;
PRUint32 mAdapterDeviceID2;
PRUint32 mWindowsVersion;
PRBool mHasDualGPU;
PRBool mIsGPU2Active;
PRBool mHasDriverVersionMismatch;
};

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

@ -343,6 +343,13 @@ GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
return NS_OK;
}
/* readonly attribute DOMString adapterDescription2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterRAM; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
@ -351,6 +358,13 @@ GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
return NS_OK;
}
/* readonly attribute DOMString adapterRAM2; */
NS_IMETHODIMP
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriver; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
@ -359,6 +373,13 @@ GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
return NS_OK;
}
/* readonly attribute DOMString adapterDriver2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverVersion; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
@ -368,6 +389,13 @@ GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverVersion2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute DOMString adapterDriverDate; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
@ -376,6 +404,13 @@ GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
return NS_OK;
}
/* readonly attribute DOMString adapterDriverDate2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
@ -384,6 +419,13 @@ GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
@ -392,6 +434,20 @@ GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute boolean isGPU2Active; */
NS_IMETHODIMP
GfxInfo::GetIsGPU2Active(PRBool* aIsGPU2Active)
{
return NS_ERROR_FAILURE;
}
} // end namespace widget
} // end namespace mozilla

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

@ -63,6 +63,14 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(PRBool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;

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

@ -0,0 +1,25 @@
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
function get_test_program(prog)
{
var progPath = do_get_cwd();
progPath.append(prog);
if (isWindows)
progPath.leafName = progPath.leafName + ".exe";
return progPath;
}
function set_process_running_environment()
{
var envSvc = Components.classes["@mozilla.org/process/environment;1"].
getService(Components.interfaces.nsIEnvironment);
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties);
var greDir = dirSvc.get("GreD", Components.interfaces.nsIFile);
envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
// For Linux
envSvc.set("LD_LIBRARY_PATH", greDir.path);
//XXX: handle windows
}

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

@ -42,32 +42,6 @@ const TEST_UNICODE_ARGS = ["M\u00F8z\u00EEll\u00E5",
"\u09AE\u09CB\u099C\u09BF\u09B2\u09BE",
"\uD808\uDE2C\uD808\uDF63\uD808\uDDB7"];
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
function get_test_program(prog)
{
var progPath = do_get_cwd();
progPath.append(prog);
if (isWindows)
progPath.leafName = progPath.leafName + ".exe";
return progPath;
}
function set_environment()
{
var envSvc = Components.classes["@mozilla.org/process/environment;1"].
getService(Components.interfaces.nsIEnvironment);
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties);
var greDir = dirSvc.get("GreD", Components.interfaces.nsIFile);
envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
// For Linux
envSvc.set("LD_LIBRARY_PATH", greDir.path);
//XXX: handle windows
}
// test if a process can be started, polled for its running status
// and then killed
function test_kill()
@ -231,35 +205,8 @@ function test_notify_killed()
process.kill();
}
// test if killing a process that is already finished doesn't crash
function test_kill_2()
{
var file = get_test_program("TestQuickReturn");
var thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService().currentThread;
for (var i = 0; i < 1000; i++) {
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.run(false, [], 0);
try {
process.kill();
}
catch (e) { }
// We need to ensure that we process any events on the main thread -
// this allow threads to clean up properly and avoid out of memory
// errors during the test.
while (thread.hasPendingEvents())
thread.processNextEvent(false);
}
}
function run_test() {
set_environment();
set_process_running_environment();
test_kill();
test_quick();
test_arguments();
@ -267,5 +214,4 @@ function run_test() {
test_unicode_app();
do_test_pending();
test_notify_blocking();
test_kill_2();
}

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

@ -0,0 +1,27 @@
function run_test() {
set_process_running_environment();
var file = get_test_program("TestQuickReturn");
var thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService().currentThread;
for (var i = 0; i < 1000; i++) {
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.run(false, [], 0);
try {
process.kill();
}
catch (e) { }
// We need to ensure that we process any events on the main thread -
// this allow threads to clean up properly and avoid out of memory
// errors during the test.
while (thread.hasPendingEvents())
thread.processNextEvent(false);
}
}

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

@ -1,5 +1,5 @@
[DEFAULT]
head =
head = head_xpcom.js
tail =
[test_bug121341.js]
@ -21,6 +21,8 @@ tail =
[test_mac_bundle.js]
[test_nsIMutableArray.js]
[test_nsIProcess.js]
[test_nsIProcess_stress.js]
skip-if = os == "win" # See bug: 676412
[test_pipe.js]
[test_storagestream.js]
[test_streams.js]