swagger-api / swagger-api/swagger-ui

Javascript syntax error on Edge 44.x

Open
#7,468 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: browser specific
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)

OS: Window
Browser: Microsoft Edge
Version: 44.17763.831.0
Swagger-UI version: 3.51.2

Content & configuration

Example Swagger/OpenAPI definition:

<script src="swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
	window.ui = null;
	function loadApplicationList(url, callBackFunction) {
		var xhttp;
		xhttp=new XMLHttpRequest();
		xhttp.onreadystatechange = function() {
			if (this.readyState == 4 && this.status == 200) {
				callBackFunction(this);
			}
		}
		xhttp.open("GET", url, true);
		xhttp.send();			
	};

	function initSwagger(xhttp){
		const ui = SwaggerUIBundle({
			urls: JSON.parse(xhttp.responseText),
			validatorUrl : false,
			dom_id: '#swagger-ui',
			deepLinking: true,
			presets: [
				SwaggerUIBundle.presets.apis,SwaggerUIStandalonePreset
			],
			plugins: [
				SwaggerUIBundle.plugins.DownloadUrl
			],
			layout: "StandaloneLayout"
		[})]([url](url))
		window.ui = ui;
	}	

	window.onload = [loadApplicationList("apidoc/retrievedoclist",initSwagger);
</script>
Describe the bug you're encountering

javascript syntax error - no variable defined at catch block, It's work normal in Chrome browser.
Incorrect syntax: try{}catch{}
Correct syntax: try{}catch(e){}

Screenshots

image

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the syntax error in Microsoft Edge 44.17763.831.0 using the provided HTML setup and Swagger UI 3.51.2. Inspect swagger-ui-bundle.js and swagger-ui-standalone-preset.js for the reported catch syntax, then verify the bundled assets load without a syntax error in Edge while preserving Chrome behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.