| Index: chrome/test/data/extensions/api_test/stubs/content_script.js
|
| diff --git a/chrome/test/data/extensions/api_test/stubs/content_script.js b/chrome/test/data/extensions/api_test/stubs/content_script.js
|
| index 69982cc8661a4dba98a2105714367eeeb1c23050..3ecae6f6e72a20aa2ff57cc7c5ec0d24f3c2950a 100644
|
| --- a/chrome/test/data/extensions/api_test/stubs/content_script.js
|
| +++ b/chrome/test/data/extensions/api_test/stubs/content_script.js
|
| @@ -16,10 +16,6 @@ chrome.extension.sendRequest("getApi", function(apis) {
|
| var unprivilegedPaths = [];
|
| apis.forEach(function(module) {
|
| var namespace = module.namespace;
|
| - if (!module.unprivileged) {
|
| - privilegedPaths.push(namespace);
|
| - return;
|
| - }
|
|
|
| ["functions", "events"].forEach(function(section) {
|
| if (typeof(module[section]) == "undefined")
|
| @@ -53,16 +49,13 @@ chrome.extension.sendRequest("getApi", function(apis) {
|
| // error on access. The path is a namespace or function/property/event etc.
|
| // within a namespace, and is dot-separated.
|
| function testPath(path, expectError) {
|
| - console.log("trying " + path);
|
| var parts = path.split('.');
|
|
|
| - // Iterate over each component of the path, making sure all but the last part
|
| - // is defined. The last part should either be defined or throw an error on
|
| - // attempted access.
|
| var module = chrome;
|
| for (var i = 0; i < parts.length; i++) {
|
| if (i < parts.length - 1) {
|
| - // Not the last component, so expect non-null / no exception.
|
| + // Not the last component. Should not throw an exception, but allowed to
|
| + // be undefined (because some paths are only defined on some platforms).
|
| try {
|
| module = module[parts[i]];
|
| } catch (err) {
|
| @@ -70,6 +63,8 @@ function testPath(path, expectError) {
|
| parts.slice(0, i+1).join('.') + '(' + err + ')');
|
| return false;
|
| }
|
| + if (typeof(module) == "undefined")
|
| + return true;
|
| } else {
|
| // This is the last component - we expect it to either be defined or
|
| // to throw an error on access.
|
| @@ -80,7 +75,6 @@ function testPath(path, expectError) {
|
| path);
|
| return false;
|
| } else if (!expectError) {
|
| - console.log(" ok (defined): " + path);
|
| return true;
|
| }
|
| } catch (err) {
|
| @@ -90,10 +84,10 @@ function testPath(path, expectError) {
|
| }
|
| var str = err.toString();
|
| if (str.search("can only be used in extension processes.") != -1) {
|
| - console.log(" ok (correct error thrown): " + path);
|
| return true;
|
| } else {
|
| - logToConsoleAndStdout(" fail (wrong error: '" + str + "')");
|
| + logToConsoleAndStdout(
|
| + "fail: " + path + " (wrong error: '" + str + "')");
|
| return false;
|
| }
|
| }
|
| @@ -130,7 +124,7 @@ function doTest(privilegedPaths, unprivilegedPaths) {
|
|
|
| if (!privilegedPaths || privilegedPaths.length < 1 || !unprivilegedPaths ||
|
| unprivilegedPaths.length < 1) {
|
| - port.postMessage("fail");
|
| + reportFailure();
|
| return;
|
| }
|
|
|
|
|