Skip to content

Commit

Permalink
Add simple browser extension (#109276)
Browse files Browse the repository at this point in the history
* Add support for TS's Hierarchical refactorings API

microsoft/TypeScript#41975

* Add simple browser extension

This change adds a new 'simple browser' extension. This extension uses a webview to render webpages directly in VS Code. We plan on using it for optionally previewing local servers in both desktop and codespaces

The browser itself has a number of limitations due to the security around iframes:

- It traps keyboard focus
- We can't detect if a page fails to load
- We can't track the current url of the iframe

* Add experimental alert when the iframe is focused

* Disable events on focus warning

* Hooking up simple browser to opener
  • Loading branch information
mjbvz authored Jan 5, 2021
1 parent 69dfa67 commit 3ed300e
Show file tree
Hide file tree
Showing 25 changed files with 3,585 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/gulpfile.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const compilations = [
'php-language-features/tsconfig.json',
'python/tsconfig.json',
'search-result/tsconfig.json',
'simple-browser/tsconfig.json',
'typescript-language-features/test-workspace/tsconfig.json',
'typescript-language-features/tsconfig.json',
'vscode-api-tests/tsconfig.json',
Expand Down
1 change: 1 addition & 0 deletions build/hygiene.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const indentationFilter = [
'!**/*.Dockerfile',
'!**/*.dockerfile',
'!extensions/markdown-language-features/media/*.js',
'!extensions/simple-browser/media/*.js',
];

const copyrightFilter = [
Expand Down
1 change: 1 addition & 0 deletions build/npm/dirs.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exports.dirs = [
'extensions/npm',
'extensions/php-language-features',
'extensions/search-result',
'extensions/simple-browser',
'extensions/typescript-language-features',
'extensions/vscode-api-tests',
'extensions/vscode-colorize-tests',
Expand Down
12 changes: 12 additions & 0 deletions extensions/simple-browser/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test/**
test-workspace/**
src/**
tsconfig.json
out/test/**
out/**
extension.webpack.config.js
extension-browser.webpack.config.js
cgmanifest.json
yarn.lock
preview-src/**
webpack.config.js
3 changes: 3 additions & 0 deletions extensions/simple-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Simple Browser files

**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
17 changes: 17 additions & 0 deletions extensions/simple-browser/extension-browser.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

//@ts-check

'use strict';

const withBrowserDefaults = require('../shared.webpack.config').browser;

module.exports = withBrowserDefaults({
context: __dirname,
entry: {
extension: './src/extension.ts'
}
});
20 changes: 20 additions & 0 deletions extensions/simple-browser/extension.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

//@ts-check

'use strict';

const withDefaults = require('../shared.webpack.config');

module.exports = withDefaults({
context: __dirname,
resolve: {
mainFields: ['module', 'main']
},
entry: {
extension: './src/extension.ts',
}
});
201 changes: 201 additions & 0 deletions extensions/simple-browser/media/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions extensions/simple-browser/media/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3ed300e

Please sign in to comment.