Skip to content

Commit

Permalink
[EC-661] Add web worker code bundles to Safari browser extension (#3986)
Browse files Browse the repository at this point in the history
* Make browser bundle encrypt-worker.ts into a single named file

* Add encrypt-worker bundle to xcode proj

(cherry picked from commit da542c8)
  • Loading branch information
eliykat committed Nov 8, 2022
1 parent b1b9cf1 commit bf2c7f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/browser/src/safari/desktop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
03100CAF291891F4008E14EF /* encrypt-worker.js in Resources */ = {isa = PBXBuildFile; fileRef = 03100CAE291891F4008E14EF /* encrypt-worker.js */; };
55E0374D2577FA6B00979016 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E0374C2577FA6B00979016 /* AppDelegate.swift */; };
55E037502577FA6B00979016 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55E0374E2577FA6B00979016 /* Main.storyboard */; };
55E037522577FA6B00979016 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E037512577FA6B00979016 /* ViewController.swift */; };
Expand Down Expand Up @@ -50,6 +51,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
03100CAE291891F4008E14EF /* encrypt-worker.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "encrypt-worker.js"; path = "../../../build/encrypt-worker.js"; sourceTree = "<group>"; };
5508DD7926051B5900A85C58 /* libswiftAppKit.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswiftAppKit.tbd; path = usr/lib/swift/libswiftAppKit.tbd; sourceTree = SDKROOT; };
55E037482577FA6B00979016 /* desktop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = desktop.app; sourceTree = BUILT_PRODUCTS_DIR; };
55E0374B2577FA6B00979016 /* desktop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = desktop.entitlements; sourceTree = "<group>"; };
Expand Down Expand Up @@ -148,6 +150,7 @@
55E0376F2577FA6F00979016 /* Resources */ = {
isa = PBXGroup;
children = (
03100CAE291891F4008E14EF /* encrypt-worker.js */,
55E037702577FA6F00979016 /* popup */,
55E037712577FA6F00979016 /* background.js */,
55E037722577FA6F00979016 /* images */,
Expand Down Expand Up @@ -263,6 +266,7 @@
55E037802577FA6F00979016 /* background.html in Resources */,
55E0377A2577FA6F00979016 /* background.js in Resources */,
55E037792577FA6F00979016 /* popup in Resources */,
03100CAF291891F4008E14EF /* encrypt-worker.js in Resources */,
55E0377C2577FA6F00979016 /* notification in Resources */,
55E0377E2577FA6F00979016 /* vendor.js in Resources */,
55E0377D2577FA6F00979016 /* content in Resources */,
Expand Down
1 change: 1 addition & 0 deletions apps/browser/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const config = {
"content/contextMenuHandler": "./src/content/contextMenuHandler.ts",
"content/message_handler": "./src/content/message_handler.ts",
"notification/bar": "./src/notification/bar.js",
"encrypt-worker": "../../libs/common/src/services/cryptography/encrypt.worker.ts",
},
optimization: {
minimize: ENV !== "development",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export class MultithreadEncryptServiceImplementation extends EncryptServiceImple
this.logService.info("Starting decryption using multithreading");

this.worker ??= new Worker(
new URL("@bitwarden/common/services/cryptography/encrypt.worker.ts", import.meta.url)
new URL(
/* webpackChunkName: 'encrypt-worker' */
"@bitwarden/common/services/cryptography/encrypt.worker.ts",
import.meta.url
)
);

this.restartTimeout();
Expand Down

0 comments on commit bf2c7f8

Please sign in to comment.