Skip to content

修复了Edge中输入空内容时跳转和命名标签页的漏洞#751

Draft
stxttkx wants to merge 2 commits into
win12-online:mainfrom
stxttkx:stxttkx-patch-8-fixEdge
Draft

修复了Edge中输入空内容时跳转和命名标签页的漏洞#751
stxttkx wants to merge 2 commits into
win12-online:mainfrom
stxttkx:stxttkx-patch-8-fixEdge

Conversation

@stxttkx
Copy link
Copy Markdown
Contributor

@stxttkx stxttkx commented Mar 2, 2026

(建议来自issue #747

问题还需完善。

我正在向大家征集关于以下计划的意见:

  • 添加错误提示(形如计算器“除数不得等于0”的错误提示)

@Bedevere-win12-bot
Copy link
Copy Markdown

PR 预览

项目 详情
预览链接 https://tangyuan0821.github.io/win12-pr-preview/pr-751/desktop.html
提交哈希 e85545d3f8970f8f5165f4d430fce9e360c7fe9d
部署时间(Asia/Shanghai) 2026-03-02 16:03:38 CST

Tip

💡 若 PR 继续提交,新预览将自动覆盖并更新本评论。
如您发现问题,欢迎通过issues提交反馈。

@Bedevere-win12-bot
Copy link
Copy Markdown

PR 预览

项目 详情
预览链接 https://tangyuan0821.github.io/win12-pr-preview/pr-751/desktop.html
提交哈希 9d9bb2b468c7aed3ed72778d301c73a26cbe0b0c
部署时间(Asia/Shanghai) 2026-03-02 16:07:20 CST

Tip

💡 若 PR 继续提交,新预览将自动覆盖并更新本评论。
如您发现问题,欢迎通过issues提交反馈。

@stxttkx stxttkx force-pushed the stxttkx-patch-8-fixEdge branch from 9d9bb2b to e85545d Compare March 2, 2026 08:09
@Bedevere-win12-bot
Copy link
Copy Markdown

PR 预览

项目 详情
预览链接 https://tangyuan0821.github.io/win12-pr-preview/pr-751/desktop.html
提交哈希 e85545d3f8970f8f5165f4d430fce9e360c7fe9d
部署时间(Asia/Shanghai) 2026-03-02 16:09:44 CST

Tip

💡 若 PR 继续提交,新预览将自动覆盖并更新本评论。
如您发现问题,欢迎通过issues提交反馈。

@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented Mar 2, 2026

提交哈希 9d9bb2b468c7aed3ed72778d301c73a26cbe0b0c

为啥在我本地网页上没有新标签页上的问题,PR预览就有呢?写了白写的commit已删

而且点击返回上一步以后,重复此操作就不会再次发生同样的情况

Comment thread desktop.html
t = t.substring(0,7) + '...';
}
var className = 'save_' + Math.random().toString(36).substr(2);
var className = 'save_' + Math.random().toString(36).substr(2);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个语句到底是跟谁对齐的?

Comment thread desktop.html Outdated
Comment on lines +2166 to +2168
<input type="text" onkeyup="if(event.keyCode==13&&$(this).val()!=''){apps.edge.goto($(this).val())}"
<input type="text" onkeyup="if(event.keyCode==13&&$(this).val().trim().length()!=0){apps.edge.goto($(this).val())}"
placeholder="在必应中搜索,或输入一个网址" class="url" spellcheck="false" id="edge-path" data-i18n-attr="placeholder" data-i18n-key="edge.schbing">
<input type="text" onkeyup="if(event.keyCode==13&&$(this).val()!=''){m_tab.rename('edge',$(this).val());}"
<input type="text" onkeyup="if(event.keyCode==13&&$(this).val().trim().length()!=0){m_tab.rename('edge',$(this).val());}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得可以直接把输入框的内容修改为trim后的结果,这样既能避免这种问题又不用动现有代码(而且还顺便解决了搜索词前后有空格的情况)

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lingbopro 照你说的这样的话,如果处理结果为空,系统就会跳转到搜索关键字为空的搜索网站。。。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lingbopro 照你说的这样的话,如果处理结果为空,系统就会跳转到搜索关键字为空的搜索网站。。。

啊?现有的代码没有判空嘛?

Copy link
Copy Markdown
Contributor Author

@stxttkx stxttkx Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在mainpage.html中是这样

Copy link
Copy Markdown
Contributor Author

@stxttkx stxttkx Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在顶部菜单栏中是正常的

@tjy-gitnub
Copy link
Copy Markdown
Member

tjy-gitnub commented Mar 6, 2026

请尝试运行后再提交pr!

image

this 没有这个属性

@tjy-gitnub tjy-gitnub marked this pull request as draft March 6, 2026 11:12
@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented Mar 6, 2026

this 没有这个属性

@tjy-gitnub 我怎么记得我没有修改这里?这是上古代码么

@lingbopro
Copy link
Copy Markdown
Member

请尝试运行后再提交pr!

image

this 没有这个属性

这真怪不了他,更改的代码里完全跟这个没关系,这纯属上古史山

@tjy-gitnub
Copy link
Copy Markdown
Member

但是不管怎么说,程序跑不了嗄(😂

@tjy-gitnub
Copy link
Copy Markdown
Member

应该是这里的问题:
image
length并不是一个函数

@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented Mar 6, 2026

length并不是一个函数

我本地网页能跑,没开liveserver,不知道你说的对不对

@tjy-gitnub
Copy link
Copy Markdown
Member

image 确实是不能这样写的,不论有没有liveserver都不行。我这边跑了一下试了,确实搜索不了嗄,回车之后没反应。你再改改呢?

@lingbopro

This comment has been minimized.

@freedom-323
Copy link
Copy Markdown
Contributor

修掉语法后实测还是有问题。。。输入0后炸开

@txcxgzs
Copy link
Copy Markdown
Contributor

txcxgzs commented May 16, 2026

我在 #812 里也修了这个问题,这里贴一下我的方案供参考:

goto 函数入口加 trim 和空白拦截:

goto: (u, clear = true) => {
    u = u.trim();
    if (!u) return;
    // ...原有逻辑
}

另外地址栏和新标签页搜索框的触发条件也加了 .trim()

// 地址栏
if(event.keyCode==13&&$(this).val().trim()!=''){apps.edge.goto($(this).val())}

// 新标签页搜索框
if (e.keyCode == 13 && $(this).val().trim() != '') {
    apps.edge.goto($(this).val());
}

如果需要我直接提交到这个分支也可以,给我写权限就行。

@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented May 16, 2026

如果需要我直接提交到这个分支也可以,给我写权限就行。

@txcxgzs 明天早上我来搞定

另,@tjy-gitnub @tangyuan0821 这个分支的内容太过陈旧,我不确定更改目标文件desktop.htmlmodule/apps.js是否存在与当前更改发生冲突的内容。

@tjy-gitnub
Copy link
Copy Markdown
Member

那不妨另外开一个pr?

@txcxgzs
Copy link
Copy Markdown
Contributor

txcxgzs commented May 16, 2026

已经有单独的 PR 了:#812 ,麻烦看看

@stxttkx stxttkx force-pushed the stxttkx-patch-8-fixEdge branch from e6d3374 to e85545d Compare May 17, 2026 01:40
@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented May 17, 2026

@tjy-gitnub @lingbopro @freedom-323 改好了

@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented May 17, 2026

@txcxgzs 你pr的那个分支好像改动太多了,一些名称的优化建议另开pr

@stxttkx
Copy link
Copy Markdown
Contributor Author

stxttkx commented May 17, 2026

预览见https://win12-5j5.pages.dev/desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants