From 4b421550d3c10bb3c11f4be1a4c090d6e96ac910 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 15 May 2019 09:44:57 +0100 Subject: [PATCH] Stop using application/x-javascript as a mime type and use the RFC-compliant application/javascript instead. Fixes #4261 --- docs/en_US/release_notes_4_7.rst | 3 ++- web/pgadmin/browser/__init__.py | 12 ++++++------ .../browser/server_groups/servers/__init__.py | 2 +- .../foreign_servers/__init__.py | 2 +- .../foreign_servers/user_mapping/__init__.py | 2 +- .../servers/databases/schemas/domains/__init__.py | 2 +- .../databases/schemas/foreign_tables/__init__.py | 2 +- .../databases/schemas/fts_configurations/__init__.py | 2 +- .../databases/schemas/fts_dictionaries/__init__.py | 2 +- .../databases/schemas/fts_templates/__init__.py | 2 +- .../servers/databases/schemas/functions/__init__.py | 6 +++--- .../servers/databases/schemas/packages/__init__.py | 2 +- .../databases/schemas/packages/edbfuncs/__init__.py | 4 ++-- .../databases/schemas/packages/edbvars/__init__.py | 2 +- .../servers/databases/schemas/sequences/__init__.py | 2 +- .../databases/schemas/tables/constraints/__init__.py | 2 +- .../tables/constraints/check_constraint/__init__.py | 2 +- .../constraints/exclusion_constraint/__init__.py | 2 +- .../tables/constraints/foreign_key/__init__.py | 2 +- .../tables/constraints/index_constraint/__init__.py | 2 +- .../databases/schemas/tables/rules/__init__.py | 2 +- .../servers/resource_groups/__init__.py | 2 +- .../server_groups/servers/tablespaces/__init__.py | 2 +- web/pgadmin/browser/utils.py | 2 +- 24 files changed, 33 insertions(+), 32 deletions(-) diff --git a/docs/en_US/release_notes_4_7.rst b/docs/en_US/release_notes_4_7.rst index d4cfe84a4..9756e8bc2 100644 --- a/docs/en_US/release_notes_4_7.rst +++ b/docs/en_US/release_notes_4_7.rst @@ -17,4 +17,5 @@ Bug fixes | `Bug #4164 `_ - Fix file browser path issue which occurs when client is on Windows and server is on Mac/Linux. | `Bug #4218 `_ - Properly assign dropdownParent in Select2 controls. | `Bug #4219 `_ - Ensure popper.js is installed when needed. -| `Bug #4246 `_ - Fixed console error when subnode control is used in panels. \ No newline at end of file +| `Bug #4246 `_ - Fixed console error when subnode control is used in panels. +| `Bug #4261 `_ - Stop using application/x-javascript as a mime type and use the RFC-compliant application/javascript instead. \ No newline at end of file diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index b77514e65..fe2af7dc9 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -623,14 +623,14 @@ def utils(): pg_libpq_version=pg_libpq_version, support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL ), - 200, {'Content-Type': 'application/x-javascript'}) + 200, {'Content-Type': 'application/javascript'}) @blueprint.route("/js/endpoints.js") def exposed_urls(): return make_response( render_template('browser/js/endpoints.js'), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) @@ -639,7 +639,7 @@ def exposed_urls(): def error_js(): return make_response( render_template('browser/js/error.js', _=gettext), - 200, {'Content-Type': 'application/x-javascript'}) + 200, {'Content-Type': 'application/javascript'}) @blueprint.route("/js/node.js") @@ -659,14 +659,14 @@ def node_js(): edbas_help_path=edbas_help_path, _=gettext ), - 200, {'Content-Type': 'application/x-javascript'}) + 200, {'Content-Type': 'application/javascript'}) @blueprint.route("/js/messages.js") def messages_js(): return make_response( render_template('browser/js/messages.js', _=gettext), - 200, {'Content-Type': 'application/x-javascript'}) + 200, {'Content-Type': 'application/javascript'}) @blueprint.route("/js/collection.js") @@ -674,7 +674,7 @@ def messages_js(): def collection_js(): return make_response( render_template('browser/js/collection.js', _=gettext), - 200, {'Content-Type': 'application/x-javascript'}) + 200, {'Content-Type': 'application/javascript'}) @blueprint.route("/browser.css") diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py index de0684033..dd4572b64 100644 --- a/web/pgadmin/browser/server_groups/servers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/__init__.py @@ -930,7 +930,7 @@ class ServerNode(PGChildNodeView): "servers/supported_servers.js", server_types=ServerType.types() ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def connect_status(self, gid, sid): diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py index 10f919c95..78f7d281a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/__init__.py @@ -206,7 +206,7 @@ class ForeignServerView(PGChildNodeView): "foreign_servers/js/foreign_servers.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py index 626d02501..0ba0ac500 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/__init__.py @@ -223,7 +223,7 @@ class UserMappingView(PGChildNodeView): "user_mappings/js/user_mappings.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py index c6895eb04..1bc8b6570 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py @@ -255,7 +255,7 @@ class DomainView(PGChildNodeView, DataTypeReader): "domains/js/domains.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py index 2d206bff7..8999d2e1f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py @@ -328,7 +328,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader): "foreign_tables/js/foreign_tables.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py index df9bb4e46..7c0a22637 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/__init__.py @@ -224,7 +224,7 @@ class FtsConfigurationView(PGChildNodeView): "fts_configuration/js/fts_configuration.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py index e95d8abd9..5bb913391 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/__init__.py @@ -212,7 +212,7 @@ class FtsDictionaryView(PGChildNodeView): "fts_dictionary/js/fts_dictionary.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py index 604256240..ea3a58db0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/__init__.py @@ -207,7 +207,7 @@ class FtsTemplateView(PGChildNodeView): "fts_template/js/fts_templates.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py index fda1cf874..b41ec44d7 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py @@ -313,7 +313,7 @@ class FunctionView(PGChildNodeView, DataTypeReader): "function/js/functions.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): @@ -1686,7 +1686,7 @@ class ProcedureView(FunctionView): "procedure/js/procedures.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) @@ -1797,7 +1797,7 @@ class TriggerFunctionView(FunctionView): "trigger_function/js/trigger_functions.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py index 89c5ed639..8e6c463ea 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/__init__.py @@ -121,7 +121,7 @@ class PackageView(PGChildNodeView): "package/js/package.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(action=None): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py index a6b0643b9..286018242 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py @@ -201,7 +201,7 @@ class EdbFuncView(PGChildNodeView, DataTypeReader): "edbfunc/js/edbfunc.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): @@ -709,7 +709,7 @@ class EdbProcView(EdbFuncView): "edbproc/js/edbproc.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/__init__.py index db44b7023..3c4346e18 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/__init__.py @@ -175,7 +175,7 @@ class EdbVarView(PGChildNodeView, DataTypeReader): "edbvar/js/edbvar.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py index d0b40f075..96fd0e6df 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py @@ -126,7 +126,7 @@ class SequenceView(PGChildNodeView): "sequence/js/sequence.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(action=None): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py index b3dd8a009..7d90195be 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/__init__.py @@ -149,5 +149,5 @@ def module_js(): for n in ConstraintRegistry.registry ] ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py index aa422066a..9437116b3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py @@ -196,7 +196,7 @@ class CheckConstraintView(PGChildNodeView): "check_constraint/js/check_constraint.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py index e204f5e09..fbe3a480d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py @@ -223,7 +223,7 @@ class ExclusionConstraintView(PGChildNodeView): "exclusion_constraint/js/exclusion_constraint.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py index e2f04afba..b581fe834 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/__init__.py @@ -233,7 +233,7 @@ class ForeignKeyConstraintView(PGChildNodeView): "foreign_key/js/foreign_key.js", _=_ ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py index dac45a0d0..d1d36d520 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py @@ -245,7 +245,7 @@ class IndexConstraintView(PGChildNodeView): node_type=self.node_type, node_label=self.node_label ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py index bdbd4f1cf..b45ed3ea9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/__init__.py @@ -188,7 +188,7 @@ class RuleView(PGChildNodeView): "rules/js/rules.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py index ea0a2ed85..ea564b91b 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/__init__.py @@ -219,7 +219,7 @@ class ResourceGroupView(NodeView): "resource_groups/js/resource_groups.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py index 46940b4e7..5317ea712 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py @@ -105,7 +105,7 @@ class TablespaceView(PGChildNodeView): "tablespaces/js/tablespaces.js", _=gettext ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def check_precondition(f): diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py index 52b3f51a5..2fe2d9080 100644 --- a/web/pgadmin/browser/utils.py +++ b/web/pgadmin/browser/utils.py @@ -298,7 +298,7 @@ class NodeView(with_metaclass(MethodViewType, View)): flask.render_template( "{0}/js/{0}.js".format(self.node_type) ), - 200, {'Content-Type': 'application/x-javascript'} + 200, {'Content-Type': 'application/javascript'} ) def children(self, *args, **kwargs):