Commit 19e4765a authored by hanxi's avatar hanxi Committed by Commit bot

Revert: Implement declarative content script API for <webview> [js part]:

https://codereview.chromium.org/718203005/

<webview> tag will not support declarative content script API anymore. Instead,
we would like to support dynamically add/remove content scripts,
which are similar to content scripts for Chrome Extension.

BUG=461052

Review URL: https://codereview.chromium.org/975133002

Cr-Commit-Position: refs/heads/master@{#318972}
parent 82b5703e
......@@ -925,14 +925,6 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) {
TestHelper("testWebRequestAPIExistence", "web_view/shim", NO_TEST_SERVER);
}
// Tests the existence of DeclarativeContent API event objects on the request
// object, on the webview element, and hanging directly off webview.
IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestDeclarativeContentAPIExistence) {
TestHelper("testDeclarativeContentAPIExistence",
"web_view/shim",
NO_TEST_SERVER);
}
// http://crbug.com/315920
#if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
#define MAYBE_Shim_TestChromeExtensionURL DISABLED_Shim_TestChromeExtensionURL
......
......@@ -19,23 +19,6 @@ var idGeneratorNatives = requireNative('id_generator');
var MessagingNatives = requireNative('messaging_natives');
var utils = require('utils');
var WebViewImpl = require('webView').WebViewImpl;
var DeclarativeContentSchema =
requireNative('schema_registry').GetSchema('declarativeContent');
var DeclarativeContentEvent = function(opt_eventName,
opt_argSchemas,
opt_eventOptions,
opt_webViewInstanceId) {
EventBindings.Event.call(this,
opt_eventName,
opt_argSchemas,
opt_eventOptions,
opt_webViewInstanceId);
}
DeclarativeContentEvent.prototype = {
__proto__: EventBindings.Event.prototype
};
function GetUniqueSubEventName(eventName) {
return eventName + '/' + idGeneratorNatives.GetNextId();
......@@ -192,35 +175,3 @@ WebViewImpl.prototype.setupExperimentalContextMenus = function() {
enumerable: true
});
};
WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents = function(
request) {
var createDeclarativeContentEvent = function(declarativeContentEvent) {
return function() {
if (!this[declarativeContentEvent.name]) {
this[declarativeContentEvent.name] =
new DeclarativeContentEvent(
'webViewInternal.declarativeContent.' +
declarativeContentEvent.name,
declarativeContentEvent.parameters,
declarativeContentEvent.options,
this.viewInstanceId);
}
return this[declarativeContentEvent.name];
}.bind(this);
}.bind(this);
for (var i = 0; i < DeclarativeContentSchema.events.length; ++i) {
var eventSchema = DeclarativeContentSchema.events[i];
var declarativeContentEvent = createDeclarativeContentEvent(eventSchema);
Object.defineProperty(
request,
eventSchema.name,
{
get: declarativeContentEvent,
enumerable: true
}
);
}
return request;
};
......@@ -549,38 +549,6 @@ function testWebRequestAPIExistence() {
document.body.appendChild(webview);
}
function testDeclarativeContentAPIExistence() {
var apiPropertiesToCheck = [
// Declarative Content API.
'onPageChanged'
];
var webview = document.createElement('webview');
webview.setAttribute('partition', arguments.callee.name);
webview.addEventListener('loadstop', function(e) {
for (var i = 0; i < apiPropertiesToCheck.length; ++i) {
embedder.test.assertEq('object',
typeof webview.request[apiPropertiesToCheck[i]]);
embedder.test.assertEq(
'function',
typeof webview.request[apiPropertiesToCheck[i]].addRules);
embedder.test.assertEq(
'function',
typeof webview.request[apiPropertiesToCheck[i]].getRules);
embedder.test.assertEq(
'function',
typeof webview.request[apiPropertiesToCheck[i]].removeRules);
}
// Try to overwrite webview.request, shall not succeed.
webview.request = '123';
embedder.test.assertTrue(typeof webview.request !== 'string');
embedder.test.succeed();
});
webview.setAttribute('src', 'data:text/html,webview check api');
document.body.appendChild(webview);
}
// This test verifies that the loadstart, loadstop, and exit events fire as
// expected.
function testEventName() {
......@@ -2080,7 +2048,6 @@ embedder.test.testList = {
testInlineScriptFromAccessibleResources,
'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL,
'testWebRequestAPIExistence': testWebRequestAPIExistence,
'testDeclarativeContentAPIExistence': testDeclarativeContentAPIExistence,
'testEventName': testEventName,
'testOnEventProperties': testOnEventProperties,
'testLoadProgressEvent': testLoadProgressEvent,
......
......@@ -231,10 +231,6 @@ WebViewImpl.prototype.maybeGetChromeWebViewEvents = function() {};
// Implemented when the experimental WebView API is available.
WebViewImpl.maybeGetExperimentalApiMethods = function() { return []; };
WebViewImpl.prototype.setupExperimentalContextMenus = function() {};
WebViewImpl.prototype.maybeSetupExperimentalChromeWebViewEvents =
function(request) {
return request;
};
GuestViewContainer.registerElement(WebViewImpl);
......
......@@ -266,7 +266,6 @@ WebViewEvents.prototype.setupWebRequestEvents = function() {
);
}
request = this.webViewImpl.maybeSetupExperimentalChromeWebViewEvents(request);
this.webViewImpl.setRequestPropertyOnWebViewElement(request);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment