Skip to content

Commit 257cd1a

Browse files
authored
test-app: Update to match new API (#146)
* test-app: Update to match new API * remove unused parameters to event registration functions * update more things
1 parent 5570518 commit 257cd1a

File tree

5 files changed

+345
-465
lines changed

5 files changed

+345
-465
lines changed

test_app/index.html

Lines changed: 57 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ <h5>ContextMenusCreateProperites createProperties/updateProperties</h5>
111111
<option value="audio">audio</option>
112112
</select>
113113

114-
<label for="context_menus_create_properties_document_url_patterns_in">documentUrlPatterns</label>
114+
<label for="context_menus_create_properties_document_url_patterns_in">documentURLPatterns</label>
115115
<input type="text" id="context_menus_create_properties_document_url_patterns_in" />
116116

117117
<label for="context_menus_create_properties_enabled_chk">enabled</label>
@@ -123,7 +123,7 @@ <h5>ContextMenusCreateProperites createProperties/updateProperties</h5>
123123
<label for="context_menus_create_properties_parentId_in">parentId</label>
124124
<input type="text" id="context_menus_create_properties_parentId_in" />
125125

126-
<label for="context_menus_create_properties_target_url_patterns_in">targetUrlPatterns</label>
126+
<label for="context_menus_create_properties_target_url_patterns_in">targetURLPatterns</label>
127127
<input type="text" id="context_menus_create_properties_target_url_patterns_in" />
128128

129129
<label for="context_menus_create_properties_title_in">title</label>
@@ -161,10 +161,10 @@ <h5>ContextMenusCreateProperites createProperties/updateProperties</h5>
161161
<div class="subcontrols">
162162
<h4>WebRequest</h4>
163163

164-
<h5>RequestFilter filter</h5>
164+
<h5>Interceptor options</h5>
165165

166-
<label for="request_filter_types">types</label>
167-
<select id="request_filter_types" multiple>
166+
<label for="interceptor_types">requestTypes</label>
167+
<select id="interceptor_types" multiple>
168168
<option value="main_frame">main_frame</option>
169169
<option value="sub_frame">sub_frame</option>
170170
<option value="stylesheet">stylesheet</option>
@@ -180,165 +180,76 @@ <h5>RequestFilter filter</h5>
180180
<option value="other">other</option>
181181
</select>
182182

183-
<label for="request_filter_urls">urls</label>
184-
<input type="text" id="request_filter_urls" />
183+
<label for="interceptor_urls">urlPatterns</label>
184+
<input type="text" id="interceptor_urls" value="*://*" />
185185

186-
<label for="request_filter_window_id">windowId</label>
187-
<input type="number" id="request_filter_window_id" />
186+
<label for="interceptor_blocking">blocking</label>
187+
<input type="checkbox" id="interceptor_blocking" />
188188

189-
<h5>BlockingResponse response</h5>
189+
<label for="interceptor_headers">includeHeaders</label>
190+
<select id="interceptor_headers">
191+
<option value="none">none</option>
192+
<option value="cors">cors</option>
193+
<option value="all">all</option>
194+
</select>
195+
196+
<h5>Event listener behavior</h5>
190197

191-
<label for="blocking_response_cancel">cancel</label>
192-
<input type="checkbox" id="blocking_response_cancel" />
198+
<label for="response_cancel">cancel</label>
199+
<input type="checkbox" id="response_cancel" />
193200

194-
<label for="blocking_response_redirect_url">redirectUrl</label>
195-
<input type="text" id="blocking_response_redirect_url" />
201+
<label for="response_redirect_url">redirectUrl</label>
202+
<input type="text" id="response_redirect_url" />
196203

197-
<label for="blocking_response_request_headers">requestHeaders JSON</label>
198-
<textarea id="blocking_response_request_headers">
204+
<label for="response_request_headers">requestHeaders JSON</label>
205+
<textarea id="response_request_headers">
199206
{
200207
"name": "stringValue",
201208
"name": [1, 255],
202209
}
203210
</textarea>
204211

205-
<label for="blocking_response_response_headers">responseHeaders JSON</label>
206-
<textarea id="blocking_response_response_headers">
212+
<label for="response_response_headers">responseHeaders JSON</label>
213+
<textarea id="response_response_headers">
207214
{
208215
"name": "stringValue",
209216
"name": [1, 255],
210217
}
211218
</textarea>
212219

213220
<h6>authCredentials</h6>
214-
<label for="blocking_response_auth_credentials_password">password</label>
215-
<input type="password" id="blocking_response_auth_credentials_password" />
216-
217-
<label for="blocking_response_auth_credentials_username">username</label>
218-
<input type="text" id="blocking_response_auth_credentials_username" />
219-
220-
<h5>onAuthRequired(callback, filter, extraInfoSpec)</h5>
221-
<p>BlockingResponse <code>response</code> is used if
222-
<code>blocking</code> is specified in <code>extraInfoSpec</code> or
223-
in the <code>asyncCallback</code> parameter of
224-
<code>callback</code>.</p>
225-
226-
<label for="on_auth_required_extra_info_spec">extraInfoSpec</label>
227-
<select id="on_auth_required_extra_info_spec" multiple>
228-
<option value="responseHeaders">responseHeaders</option>
229-
<option value="blocking">blocking</option>
230-
<option value="asyncBlocking">asyncBlocking</option>
231-
<option value="extraHeaders">extraHeaders</option>
232-
</select>
233-
234-
<label for="request_on_auth_required_btn">Add onAuthRequired handler</label>
235-
<button id="request_on_auth_required_btn">Add</button>
236221

237-
<h5>onBeforeRedirect(callback, filter, extraInfoSpec)</h5>
238-
<p>BlockingResponse <code>response</code> is returned by
239-
<code>callback</code>.</p>
222+
<label for="response_auth_credentials_username">username</label>
223+
<input type="text" id="response_auth_credentials_username" />
224+
<label for="response_auth_credentials_password">password</label>
225+
<input type="password" id="response_auth_credentials_password" />
240226

241-
<label for="on_before_redirect_extra_info_spec">extraInfoSpec</label>
242-
<select id="on_before_redirect_extra_info_spec" multiple>
243-
<option value="responseHeaders">responseHeaders</option>
244-
<option value="extraHeaders">extraHeaders</option>
245-
</select>
227+
<h5>Listeners</h5>
228+
<label for="request_on_auth_required_btn">Add authrequired listener</label>
229+
<button id="request_on_auth_required_btn">Add</button>
246230

247-
<label for="request_on_before_redirect_btn">Add onBeforeRedirect handler</label>
231+
<label for="request_on_before_redirect_btn">Add beforeredirect listener</label>
248232
<button id="request_on_before_redirect_btn">Add</button>
249233

250-
<h5>onBeforeRequest(callback, filter, extrainfospec)</h5>
251-
<p>BlockingResponse <code>response</code> is returned by
252-
<code>callback</code>.</p>
253-
254-
<label for="on_before_request_extra_info_spec">extraInfoSpec</label>
255-
<select id="on_before_request_extra_info_spec" multiple>
256-
<option value="blocking">blocking</option>
257-
<option value="requestbody">requestbody</option>
258-
<option value="extraheaders">extraheaders</option>
259-
</select>
260-
261-
<label for="request_on_before_request_btn">add onBeforeRequest handler</label>
234+
<label for="request_on_before_request_btn">Add beforerequest listener</label>
262235
<button id="request_on_before_request_btn">add</button>
263236

264-
<h5>onBeforeSendHeaders(callback, filter, extrainfospec)</h5>
265-
<p>BlockingResponse <code>response</code> is returned by
266-
<code>callback</code>.</p>
267-
268-
<label for="on_before_send_headers_extra_info_spec">extraInfoSpec</label>
269-
<select id="on_before_send_headers_extra_info_spec" multiple>
270-
<option value="blocking">blocking</option>
271-
<option value="requestbody">requestbody</option>
272-
<option value="extraheaders">extraheaders</option>
273-
</select>
274-
275-
<label for="request_on_before_send_headers_btn">add onBeforeSendHeaders handler</label>
237+
<label for="request_on_before_send_headers_btn">Add beforesendheaders listener</label>
276238
<button id="request_on_before_send_headers_btn">add</button>
277239

278-
<h5>onCompleted(callback, filter, extrainfospec)</h5>
279-
<p>BlockingResponse <code>response</code> is returned by
280-
<code>callback</code>.</p>
281-
282-
<label for="on_completed_extra_info_spec">extraInfoSpec</label>
283-
<select id="on_completed_extra_info_spec" multiple>
284-
<option value="requestHeaders">requestHeaders</option>
285-
<option value="blocking">blocking</option>
286-
<option value="extraheaders">extraheaders</option>
287-
</select>
288-
289-
<label for="request_on_completed_btn">add onCompleted handler</label>
240+
<label for="request_on_completed_btn">Add completed listener</label>
290241
<button id="request_on_completed_btn">add</button>
291242

292-
<h5>onErrorOccurred(callback, filter, extrainfospec)</h5>
293-
<p>BlockingResponse <code>response</code> is returned by
294-
<code>callback</code>.</p>
295-
296-
<label for="on_error_occurred_extra_info_spec">extraInfoSpec</label>
297-
<select id="on_error_occurred_extra_info_spec" multiple>
298-
<option value="extraheaders">extraheaders</option>
299-
</select>
300-
301-
<label for="request_on_error_occurred_btn">add onErrorOccurred handler</label>
243+
<label for="request_on_error_occurred_btn">Add erroroccurred listener</label>
302244
<button id="request_on_error_occurred_btn">add</button>
303245

304-
<h5>onHeadersReceived(callback, filter, extrainfospec)</h5>
305-
<p>BlockingResponse <code>response</code> is returned by
306-
<code>callback</code>.</p>
307-
308-
<label for="on_headers_received_extra_info_spec">extraInfoSpec</label>
309-
<select id="on_headers_received_extra_info_spec" multiple>
310-
<option value="blocking">blocking</option>
311-
<option value="responseHeaders">responseHeaders</option>
312-
<option value="extraheaders">extraheaders</option>
313-
</select>
314-
315-
<label for="request_on_headers_received_btn">add onHeadersReceived handler</label>
246+
<label for="request_on_headers_received_btn">Add headersreceived listener</label>
316247
<button id="request_on_headers_received_btn">add</button>
317248

318-
<h5>onResponseStarted(callback, filter, extrainfospec)</h5>
319-
<p>BlockingResponse <code>response</code> is returned by
320-
<code>callback</code>.</p>
321-
322-
<label for="on_response_started_extra_info_spec">extraInfoSpec</label>
323-
<select id="on_response_started_extra_info_spec" multiple>
324-
<option value="responseHeaders">responseHeaders</option>
325-
<option value="extraheaders">extraheaders</option>
326-
</select>
327-
328-
<label for="request_on_response_started_btn">add onResponseStarted handler</label>
249+
<label for="request_on_response_started_btn">Add responsestarted listener</label>
329250
<button id="request_on_response_started_btn">add</button>
330251

331-
<h5>onSendHeaders(callback, filter, extrainfospec)</h5>
332-
<p>BlockingResponse <code>response</code> is returned by
333-
<code>callback</code>.</p>
334-
335-
<label for="on_send_headers_extra_info_spec">extraInfoSpec</label>
336-
<select id="on_send_headers_extra_info_spec" multiple>
337-
<option value="requestHeaders">requestHeaders</option>
338-
<option value="extraheaders">extraheaders</option>
339-
</select>
340-
341-
<label for="request_on_send_headers_btn">add onSendHeaders handler</label>
252+
<label for="request_on_send_headers_btn">Add sendheaders listener</label>
342253
<button id="request_on_send_headers_btn">add</button>
343254
</div>
344255

@@ -470,25 +381,19 @@ <h4>User Agent</h4>
470381
<div class="subcontrols">
471382
<h4>Content Scripts: Content Injection</h4>
472383

473-
<h5>ContentScriptDetails detail</h5>
384+
<h5>ContentScriptDetails</h5>
474385
<label for="content_script_details_allFrames_chk">allFrames</label>
475386
<div class="checkbox"><input type="checkbox" id="content_script_details_allFrames_chk" /></div>
476387

477-
<label for="content_script_details_excludeGlobs_in">excludeGlobs</label>
478-
<input type="text" id="content_script_details_excludeGlobs_in" />
479-
480-
<label for="content_script_details_excludeMatches_in">excludeMatches</label>
481-
<input type="text" id="content_script_details_excludeMatches_in" />
388+
<label for="content_script_details_urlPatterns_in">urlPatterns</label>
389+
<input type="text" id="content_script_details_urlPatterns_in" value="*://*" />
482390

483-
<label for="content_script_details_includeGlobs_in">includeGlobs</label>
484-
<input type="text" id="content_script_details_includeGlobs_in" />
391+
<label for="content_script_details_excludeURLPatterns_in">excludeURLPatterns</label>
392+
<input type="text" id="content_script_details_excludeURLPatterns_in" />
485393

486394
<label for="content_script_details_matchAboutBlank_chk">matchAboutBlank</label>
487395
<div class="checkbox"><input type="checkbox" id="content_script_details_matchAboutBlank_chk" /></div>
488396

489-
<label for="content_script_details_matches_in">matches</label>
490-
<input type="text" id="content_script_details_matches_in" value="<all_urls>" />
491-
492397
<label for="content_script_details_name_in">name</label>
493398
<input type="text" id="content_script_details_name_in" value="myRule" />
494399

@@ -499,28 +404,26 @@ <h5>ContentScriptDetails detail</h5>
499404
<option value="document-idle">document-idle</option>
500405
</select>
501406

502-
<h6>InjectDetails detail.css</h6>
407+
<h6>CSS details</h6>
503408
<label for="content_script_details_css_injection_items_code_in">code</label>
504-
<textarea id="content_script_details_css_injection_items_code_in">
505-
body {
409+
<textarea id="content_script_details_css_injection_items_code_in">body {
506410
background-color: red !important;
507-
}
508-
</textarea>
411+
}</textarea>
509412

510413
<label for="content_script_details_css_injection_items_files_in">files</label>
511414
<input type="text" id="content_script_details_css_injection_items_files_in" />
415+
<p><code>/red.css</code> can be used to test CSS injection.</p>
512416

513-
<h6>InjectDetails detail.js</h6>
417+
<h6>JS details</h6>
514418
<label for="content_script_details_js_injection_items_code_in">code</label>
515-
<textarea id="content_script_details_js_injection_items_code_in">
516-
(function () {
419+
<textarea id="content_script_details_js_injection_items_code_in">(function () {
517420
document.body.style.backgroundColor = 'red';
518421
return true;
519-
})();
520-
</textarea>
422+
})();</textarea>
521423

522424
<label for="content_script_details_js_injection_items_files_in">files</label>
523425
<input type="text" id="content_script_details_js_injection_items_files_in" />
426+
<p><code>/red.js</code> can be used to test CSS injection.</p>
524427

525428
<label for="add_content_scripts_result">addContentScripts([<br> detail])</label>
526429
<div id="add_content_scripts_result"></div>
@@ -534,14 +437,11 @@ <h6>InjectDetails detail.js</h6>
534437
<div class="subcontrols">
535438
<h4>executeScript: Content Injection</h4>
536439

537-
<h5>InjectDetails details</h5>
538440
<label for="inject_details_code_in">code</label>
539-
<textarea id="inject_details_code_in">
540-
(function () {
441+
<textarea id="inject_details_code_in">(function () {
541442
document.body.style.backgroundColor = 'red';
542443
return true;
543-
})();
544-
</textarea>
444+
})();</textarea>
545445

546446
<label for="inject_details_file_in">file</label>
547447
<input type="text" id="inject_details_file_in" />
@@ -554,13 +454,10 @@ <h5>InjectDetails details</h5>
554454
<div class="subcontrols">
555455
<h4>insertCSS: Content Injection</h4>
556456

557-
<h5>InjectDetails details</h5>
558457
<label for="insertcss_inject_details_code_in">code</label>
559-
<textarea id="insertcss_inject_details_code_in">
560-
body {
458+
<textarea id="insertcss_inject_details_code_in">body {
561459
background-color: red !important;
562-
}
563-
</textarea>
460+
}</textarea>
564461

565462
<label for="insertcss_inject_details_file_in">file</label>
566463
<input type="text" id="insertcss_inject_details_file_in" />

test_app/public/red.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-color: crimson !important;
3+
}

test_app/public/red.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(function () {
2+
document.body.style.backgroundColor = 'red';
3+
})();

0 commit comments

Comments
 (0)