Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/test/data/extensions/api_test/webrequest/permissionless/rules.js

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All URLs -> all hosts; also rebased Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // See ../test_declarative_permissions.js for the tests that use these rules.
6
7 var onRequest = chrome.declarativeWebRequest.onRequest;
8 var RequestMatcher = chrome.declarativeWebRequest.RequestMatcher;
9
10 chrome.test.getConfig(function(config) {
11 addRules(config.testServer.port);
12 });
13
14 function addRules(testServerPort) {
15 onRequest.addRules(
16 [{conditions: [new RequestMatcher({
17 url: {hostSuffix: '.a.com',
18 schemes: ['https']}})],
19 actions: [new chrome.declarativeWebRequest.RedirectRequest({
20 redirectUrl: 'http://www.a.com:' + testServerPort +
21 '/files/nonexistent/redirected' })]
22 },
23 {conditions: [new RequestMatcher({
24 url: {hostSuffix: '.a.com',
25 pathSuffix: '/b.html'}})],
26 actions: [new chrome.declarativeWebRequest.RedirectRequest({
27 redirectUrl: 'http://www.c.com:' + testServerPort +
28 '/files/nonexistent/redirected' })]
29 },
30 {conditions: [new RequestMatcher({
31 url: {hostSuffix: '.a.com',
32 pathSuffix: '/fake.html'}})],
33 actions: [new chrome.declarativeWebRequest.RedirectByRegEx({
34 from: '(.*)fake(.*)', to: '$1b$2'
35 })]
36 },
37
38 {conditions: [new RequestMatcher({url: {pathContains: 'blank'}})],
39 actions: [new chrome.declarativeWebRequest.RedirectToEmptyDocument()]
40 },
41 {conditions: [new RequestMatcher({url: {pathContains: 'cancel'}})],
42 actions: [new chrome.declarativeWebRequest.CancelRequest()]
43 }],
44 function(rules) {
45 if (chrome.runtime.lastError)
46 chrome.test.fail(chrome.runtime.lastError);
47 chrome.test.sendMessage("rules all registered");
48 }
49 );
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698