Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
966aeb0c
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
966aeb0c
编写于
2月 21, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move useSameOriginForRoot into options
上级
d2d8e45c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
12 deletion
+13
-12
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+3
-3
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
+1
-1
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
+4
-2
src/vs/workbench/parts/html/browser/webview.ts
src/vs/workbench/parts/html/browser/webview.ts
+4
-4
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
...bench/parts/update/electron-browser/releaseNotesEditor.ts
+1
-2
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
966aeb0c
...
...
@@ -220,9 +220,9 @@ class WebviewEditor extends BaseWebviewEditor {
this
.
contextKey
,
this
.
findInputFocusContextKey
,
{
enableWrappedPostMessage
:
true
},
false
);
enableWrappedPostMessage
:
true
,
useSameOriginForRoot
:
false
}
);
this
.
_webview
.
onDidClickLink
(
this
.
onDidClickLink
,
this
,
this
.
_contentDisposables
);
...
...
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
浏览文件 @
966aeb0c
...
...
@@ -421,7 +421,7 @@ export class ExtensionEditor extends BaseEditor {
.
then
<
void
>
(
body
=>
{
const
allowedBadgeProviders
=
this
.
extensionsWorkbenchService
.
allowedBadgeProviders
;
const
webViewOptions
=
allowedBadgeProviders
.
length
>
0
?
{
allowScripts
:
false
,
allowSvgs
:
false
,
svgWhiteList
:
allowedBadgeProviders
}
:
{};
this
.
activeWebview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
environmentService
,
this
.
contextService
,
this
.
contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
webViewOptions
,
false
);
this
.
activeWebview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
environmentService
,
this
.
contextService
,
this
.
contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
webViewOptions
);
const
removeLayoutParticipant
=
arrays
.
insert
(
this
.
layoutParticipants
,
this
.
activeWebview
);
this
.
contentDisposables
.
push
(
toDisposable
(
removeLayoutParticipant
));
this
.
activeWebview
.
contents
=
body
;
...
...
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
浏览文件 @
966aeb0c
...
...
@@ -97,8 +97,10 @@ export class HtmlPreviewPart extends WebviewEditor {
this
.
_contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
webviewOptions
,
true
);
{
...
webviewOptions
,
useSameOriginForRoot
:
true
});
if
(
this
.
input
&&
this
.
input
instanceof
HtmlInput
)
{
const
state
=
this
.
loadViewState
(
this
.
input
.
getResource
());
...
...
src/vs/workbench/parts/html/browser/webview.ts
浏览文件 @
966aeb0c
...
...
@@ -24,6 +24,7 @@ export interface WebviewOptions {
readonly
allowSvgs
?:
boolean
;
readonly
svgWhiteList
?:
string
[];
readonly
enableWrappedPostMessage
?:
boolean
;
readonly
useSameOriginForRoot
?:
boolean
;
}
export
class
Webview
{
...
...
@@ -44,8 +45,7 @@ export class Webview {
private
readonly
_contextViewService
:
IContextViewService
,
private
readonly
_contextKey
:
IContextKey
<
boolean
>
,
private
readonly
_findInputContextKey
:
IContextKey
<
boolean
>
,
private
_options
:
WebviewOptions
,
useSameOriginForRoot
:
boolean
private
_options
:
WebviewOptions
)
{
this
.
_webview
=
document
.
createElement
(
'
webview
'
);
this
.
_webview
.
setAttribute
(
'
partition
'
,
this
.
_options
.
allowSvgs
?
'
webview
'
:
`webview
${
Date
.
now
()}
`
);
...
...
@@ -62,7 +62,7 @@ export class Webview {
this
.
_webview
.
style
.
outline
=
'
0
'
;
this
.
_webview
.
preload
=
require
.
toUrl
(
'
./webview-pre.js
'
);
this
.
_webview
.
src
=
useSameOriginForRoot
?
require
.
toUrl
(
'
./webview.html
'
)
:
'
data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%20lang%3D%22en%22%20style%3D%22width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3Chead%3E%0D%0A%09%3Ctitle%3EVirtual%20Document%3C%2Ftitle%3E%0D%0A%3C%2Fhead%3E%0D%0A%3Cbody%20style%3D%22margin%3A%200%3B%20overflow%3A%20hidden%3B%20width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E
'
;
this
.
_webview
.
src
=
this
.
_options
.
useSameOriginForRoot
?
require
.
toUrl
(
'
./webview.html
'
)
:
'
data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%20lang%3D%22en%22%20style%3D%22width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3Chead%3E%0D%0A%09%3Ctitle%3EVirtual%20Document%3C%2Ftitle%3E%0D%0A%3C%2Fhead%3E%0D%0A%3Cbody%20style%3D%22margin%3A%200%3B%20overflow%3A%20hidden%3B%20width%3A%20100%25%3B%20height%3A%20100%25%22%3E%0D%0A%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E
'
;
this
.
_ready
=
new
Promise
<
this
>
(
resolve
=>
{
const
subscription
=
addDisposableListener
(
this
.
_webview
,
'
ipc-message
'
,
(
event
)
=>
{
...
...
@@ -76,7 +76,7 @@ export class Webview {
});
});
if
(
!
useSameOriginForRoot
)
{
if
(
!
this
.
_options
.
useSameOriginForRoot
)
{
let
loaded
=
false
;
this
.
_disposables
.
push
(
addDisposableListener
(
this
.
_webview
,
'
did-start-loading
'
,
()
=>
{
if
(
loaded
)
{
...
...
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
浏览文件 @
966aeb0c
...
...
@@ -97,8 +97,7 @@ export class ReleaseNotesEditor extends WebviewEditor {
this
.
_contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
{},
false
);
{});
if
(
this
.
input
&&
this
.
input
instanceof
ReleaseNotesInput
)
{
const
state
=
this
.
loadViewState
(
this
.
input
.
version
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录