SEBWIN-820, #764: Fixed missing content of isolated clipboard after navigation or reload.
This commit is contained in:
		
							parent
							
								
									4b222df6c5
								
							
						
					
					
						commit
						514414e322
					
				
					 2 changed files with 12 additions and 5 deletions
				
			
		|  | @ -158,7 +158,7 @@ namespace SafeExamBrowser.Browser | |||
| 			var downloadLogger = logger.CloneFor($"{nameof(DownloadHandler)} #{Id}"); | ||||
| 			var downloadHandler = new DownloadHandler(appConfig, downloadLogger, settings, WindowSettings); | ||||
| 			var keyboardHandler = new KeyboardHandler(); | ||||
| 			var renderHandler = new RenderProcessMessageHandler(appConfig, keyGenerator, settings, text); | ||||
| 			var renderHandler = new RenderProcessMessageHandler(appConfig, clipboard, keyGenerator, settings, text); | ||||
| 			var requestFilter = new RequestFilter(); | ||||
| 			var requestLogger = logger.CloneFor($"{nameof(RequestHandler)} #{Id}"); | ||||
| 			var resourceHandler = new ResourceHandler(appConfig, requestFilter, keyGenerator, logger, sessionMode, settings, WindowSettings, text); | ||||
|  |  | |||
|  | @ -18,14 +18,16 @@ namespace SafeExamBrowser.Browser.Handlers | |||
| 	internal class RenderProcessMessageHandler : IRenderProcessMessageHandler | ||||
| 	{ | ||||
| 		private readonly AppConfig appConfig; | ||||
| 		private readonly Clipboard clipboard; | ||||
| 		private readonly ContentLoader contentLoader; | ||||
| 		private readonly IKeyGenerator keyGenerator; | ||||
| 		private readonly BrowserSettings settings; | ||||
| 		private readonly IText text; | ||||
| 
 | ||||
| 		internal RenderProcessMessageHandler(AppConfig appConfig, IKeyGenerator keyGenerator, BrowserSettings settings, IText text) | ||||
| 		internal RenderProcessMessageHandler(AppConfig appConfig, Clipboard clipboard, IKeyGenerator keyGenerator, BrowserSettings settings, IText text) | ||||
| 		{ | ||||
| 			this.appConfig = appConfig; | ||||
| 			this.clipboard = clipboard; | ||||
| 			this.contentLoader = new ContentLoader(text); | ||||
| 			this.keyGenerator = keyGenerator; | ||||
| 			this.settings = settings; | ||||
|  | @ -37,18 +39,23 @@ namespace SafeExamBrowser.Browser.Handlers | |||
| 			var browserExamKey = keyGenerator.CalculateBrowserExamKeyHash(settings.ConfigurationKey, settings.BrowserExamKeySalt, frame.Url); | ||||
| 			var configurationKey = keyGenerator.CalculateConfigurationKeyHash(settings.ConfigurationKey, frame.Url); | ||||
| 			var api = contentLoader.LoadApi(browserExamKey, configurationKey, appConfig.ProgramBuildVersion); | ||||
| 			var clipboard = contentLoader.LoadClipboard(); | ||||
| 			var clipboardScript = contentLoader.LoadClipboard(); | ||||
| 
 | ||||
| 			frame.ExecuteJavaScriptAsync(api); | ||||
| 
 | ||||
| 			if (!settings.AllowPrint) | ||||
| 			{ | ||||
| 				frame.ExecuteJavaScriptAsync($"window.print = function(){{ alert('{text.Get(TextKey.Browser_PrintNotAllowed)}') }}"); | ||||
| 				frame.ExecuteJavaScriptAsync($"window.print = function() {{ alert('{text.Get(TextKey.Browser_PrintNotAllowed)}') }}"); | ||||
| 			} | ||||
| 
 | ||||
| 			if (settings.UseIsolatedClipboard) | ||||
| 			{ | ||||
| 				frame.ExecuteJavaScriptAsync(clipboard); | ||||
| 				frame.ExecuteJavaScriptAsync(clipboardScript); | ||||
| 
 | ||||
| 				if (clipboard.Content != default) | ||||
| 				{ | ||||
| 					frame.ExecuteJavaScriptAsync($"SafeExamBrowser.clipboard.update('', '{clipboard.Content}');"); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Damian Büchel
						Damian Büchel