Skip to content

Commit 4f0a5cf

Browse files
authored
Merge pull request #5 from clear-code/enable-to-specify-to-closing-ERR_CACHE_MISS
Enable to specify to closing err cache miss
2 parents f7cd0e0 + f89b47e commit 4f0a5cf

File tree

9 files changed

+25
-15
lines changed

9 files changed

+25
-15
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
特定のサイトを開いている際に、「フォームを再送信しますか?」ダイアログが表示されたら、自動でキャンセルするEdge向け拡張機能。
66

7-
また、ERR_CACHE_MISSページ(「フォームを再送信しますか?」が表示されるエラーページ)が表示された場合にも自動でそのページを終了する。
8-
97
## ビルド方法
108

119
* Visual Studio 2022

RepostConfirmationCanceler/ConfigLoader.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public Section(string name)
2323
internal class Config
2424
{
2525
public bool IgnoreQueryString = false;
26-
public bool OnlyMainFrame = false;
2726
public bool WarningWhenCloseDialog = false;
2827
public List<Section> SectionList = new List<Section>();
2928
}

RepostConfirmationCancelerTalk/cb_config.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct section {
3232

3333
struct config {
3434
int warning_when_close_dialog;
35+
int close_err_cache_miss_page;
3536
struct section *section;
3637
};
3738

@@ -97,10 +98,14 @@ static void parse_conf(char *data, struct config *conf)
9798
break;
9899
case '@':
99100
if (global) {
100-
if (line == "@WARNING_WHEN_CLOSE_DIALOG")
101+
if (strcmp(line, "@WARNING_WHEN_CLOSE_DIALOG") == 0)
101102
{
102103
conf->warning_when_close_dialog = 1;
103104
}
105+
if (strcmp(line, "@CLOSE_ERR_CACHE_MISS_PAGE") == 0)
106+
{
107+
conf->close_err_cache_miss_page = 1;
108+
}
104109
}
105110
break;
106111
case '-':
@@ -181,6 +186,11 @@ static char *dump_json(struct config *conf)
181186
strbuf_concat(&sb, _itoa(conf->warning_when_close_dialog, buf, 10));
182187
strbuf_putchar(&sb, ',');
183188

189+
/* CloseErrCacheMissPage */
190+
strbuf_concat(&sb, "\"CloseErrCacheMissPage\":");
191+
strbuf_concat(&sb, _itoa(conf->close_err_cache_miss_page, buf, 10));
192+
strbuf_putchar(&sb, ',');
193+
184194
/* Sections */
185195
strbuf_concat(&sb, "\"Sections\":[");
186196

doc/Sources/user-guide.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ toc-own-page: true
3535
WEBサイトをリロードした際に「フォームを再送信しますか?」ダイアログが表示されたとき、自動でキャンセルしリロードを中止するソリューションです。
3636
誤操作によるフォーム再送信の防止を目的としています。 
3737

38-
また、「フォームを再送信しますか?」というエラーページ(ERR_CACHE_MISS)が表示された場合に、自動でそのエラーページを閉じます。
39-
4038
\newpage
4139
# システム要件
4240

@@ -397,8 +395,6 @@ https://example.com/*
397395
@WARNING_WHEN_CLOSE_DIALOG
398396
```
399397
400-
「フォームを再送信しますか?」のエラーページ(ERR_CACHE_MISS)を閉じるケースでは、この警告ダイアログは表示されません。
401-
402398
### 対象URL一覧
403399
404400
対象URL一覧については、`[TARGETS]`セクションに記載します。
@@ -412,8 +408,6 @@ https://example.com/*
412408
「フォームを再送信しますか?」ダイアログのキャンセル機能は、いずれかのタブで対象URLを開いている場合に動作します。
413409
実際に開いているURLが対象URLでなくても、別のタブで対象URLを開いている場合、「フォームを再送信しますか?」ダイアログがキャンセルされます。
414410
415-
一方、「フォームを再送信しますか?」エラーページ(ERR_CACHE_MISS)を閉じる機能は対象URLでのみ動作します。
416-
417411
#### 対象URL一覧書式
418412
419413
対象URL一覧は以下のようにURL全体を改行切りで指定します。

doc/verify/sources/PreReleaseTests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* http://localhost:8080 をリロードする
4646
* [ ] 「フォームを再送信しますか?」ダイアログ一瞬表示され、キャンセルされること
4747

48-
##### ERR_CACHE_MISSページを自動で閉じるケース
48+
##### ERR_CACHE_MISSページが表示されるケース
4949

5050
* `powershell doc\verify\sources\TestTools\http_server.ps1`でローカルのWebサーバーを起動する
5151
* `http://localhost:8080`で簡易Webサーバーが起動する
@@ -55,7 +55,7 @@
5555
* フォームに「test」と入力して、「送信」ボタンを押す
5656
* 遷移先の http://localhost:8080 で右クリックし、「戻る」を押す
5757
* 遷移先の 「form.html」 で右クリックし、「進む」を押す
58-
* [ ] ポップアップダイアログが閉じること
58+
* [ ] ERR_CACHE_MISSページが表示されること
5959

6060
### すべてのURLを対象にした時の動作確認(警告ダイアログ有)
6161

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[GLOBAL]
22
@WARNING_WHEN_CLOSE_DIALOG
3+
@CLOSE_ERR_CACHE_MISS_PAGE
34

45
[TARGETS]
56
*

doc/verify/sources/TestTools/Senarios/scenario3.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[GLOBAL]
2+
@CLOSE_ERR_CACHE_MISS_PAGE
3+
14
[TARGETS]
25
*://example.com/jp*
36
*://example.com/us/??/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[GLOBAL]
2+
@CLOSE_ERR_CACHE_MISS_PAGE
3+
14
[TARGETS]
25
*://localhost:8080*

webextensions/edge/background.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ const RepostConfirmationCanceler = {
185185
const url = details.url;
186186
const tabId = details.tabId;
187187
const config = this.cached;
188-
this.handleURL(config, url, () => {
189-
this.closeTab(tabId);
190-
});
188+
if (config.CloseErrCacheMissPage) {
189+
this.handleURL(config, url, () => {
190+
this.closeTab(tabId);
191+
});
192+
}
191193
}
192194
},
193195

0 commit comments

Comments
 (0)