/
847.txt
71 lines (51 loc) · 2.76 KB
/
847.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
* 実行タイミング
[11] [[ブラウザー拡張]]の仕様は [[Webブラウザー]]により異なりますが、
次のタイミングで[[内容スクリプト]]を実行させることができるかもしれません。
[FIG(short list)[
- [[navigate]] により[[文書]]が作られた直後
- [[文書要素]]の挿入直後
- [[文書]]の [CODE(DOMe)@en[[[DOMContentLoaded]]]]
- [[文書]]の [CODE(DOMe)@en[[[load]]]]
- [[文書]]の [CODE(DOMe)@en[[[DOMContentLoaded]]]] より後で [CODE(DOMe)@en[[[load]]]]
より前の都合の良い時点
]FIG]
* 実装
[1] [CITE[Content Scripts - Google Chrome]]
( ([TIME[2014-04-02 10:39:43 +09:00]] 版))
<https://developer.chrome.com/extensions/content_scripts>
[2] [CITE[User Scripts - The Chromium Projects]]
( ([TIME[2014-04-02 07:32:33 +09:00]] 版))
<http://www.chromium.org/developers/design-documents/user-scripts/>
[7] [[内容スクリプト]]は [[isolated world]] と呼ばれる特別な環境で実行されます。
[3] [CITE@en-US[Content Scripts - Mozilla | MDN]]
([TIME[2015-05-06 08:47:31 +09:00]] 版)
<https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts>
[4] [CITE@en-US[Content Processes - Mozilla | MDN]] ([TIME[2014-12-21 23:51:46 +09:00]] 版) <https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Contributor_s_Guide/Content_Processes>
[5] [[内容スクリプト]]からの[[文書]]の [[DOM]] や[[大域オブジェクト]]へのアクセスは、
それ自体ではなく、特別なラッパーオブジェクトを介して行うようになっています [SRC[>>4]]。
;; [[Xray]] も参照。
[6] [CITE@en-US[Communicating With Other Scripts - Mozilla | MDN]]
([TIME[2014-06-05 02:42:35 +09:00]] 版)
<https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/Communicating_With_Other_Scripts>
[8] [[Chrome]] の [CODE@en["run_at": "document_start"]] は[[文書]]が作成された後で、
構文解析が始まる前 ([[子供]]がまだない時点) のようです。
[9] [CITE[Content scripts - Opera 15+ extensions documentation]]
([TIME[2015-03-14 01:51:40 +09:00]] 版)
<https://dev.opera.com/extensions/tut_content_scripts.html>
* 関連
[10] 趣旨としては [[Greasemonkey]] と同じものかもしれません。
[FIG(quote)[
[FIGCAPTION[
[12] [CITE@en-US[Chrome incompatibilities - Mozilla | MDN]]
( ([TIME[2016-06-14 10:15:04 +09:00]]))
<https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities>
]FIGCAPTION]
> content_scripts
> Firefox does not support:
> match_about_blank
> include_globs
> exclude_globs
]FIG]
[13] [CITE@en-US[Content scripts - Mozilla | MDN]]
( ([TIME[2016-04-03 13:40:20 +09:00]]))
<https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts>