@openui5/sap.ui.support 1.71.80 → 1.71.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/sap/ui/support/.library +1 -1
- package/src/sap/ui/support/RuleAnalyzer.js +1 -1
- package/src/sap/ui/support/jQuery.sap.support.js +1 -1
- package/src/sap/ui/support/library.js +7 -7
- package/src/sap/ui/support/supportRules/CommunicationBus.js +37 -0
- package/src/sap/ui/support/supportRules/Main.js +3 -29
- package/src/sap/ui/support/supportRules/RuleSet.js +1 -1
- package/src/sap/ui/support/supportRules/RuleSetLoader.js +1 -1
- package/src/sap/ui/support/supportRules/Storage.js +1 -1
- package/src/sap/ui/support/supportRules/WCBConfig.js +68 -0
- package/src/sap/ui/support/supportRules/WindowCommunicationBus.js +137 -118
- package/src/sap/ui/support/supportRules/ui/IFrameController.js +7 -11
- package/src/sap/ui/support/supportRules/ui/controllers/Analysis.controller.js +1 -1
- package/src/sap/ui/support/supportRules/ui/controllers/Issues.controller.js +1 -1
- package/src/sap/ui/support/supportRules/ui/controllers/Main.controller.js +1 -1
- package/src/sap/ui/support/supportRules/ui/controllers/PresetsController.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openui5/sap.ui.support",
|
|
3
|
-
"version": "1.71.
|
|
3
|
+
"version": "1.71.81",
|
|
4
4
|
"description": "OpenUI5 UI Library sap.ui.support",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"url": "https://github.com/SAP/openui5.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@openui5/sap.m": "1.71.
|
|
18
|
-
"@openui5/sap.ui.codeeditor": "1.71.
|
|
19
|
-
"@openui5/sap.ui.core": "1.71.
|
|
20
|
-
"@openui5/sap.ui.fl": "1.71.
|
|
21
|
-
"@openui5/sap.ui.layout": "1.71.
|
|
22
|
-
"@openui5/themelib_sap_belize": "1.71.
|
|
17
|
+
"@openui5/sap.m": "1.71.81",
|
|
18
|
+
"@openui5/sap.ui.codeeditor": "1.71.81",
|
|
19
|
+
"@openui5/sap.ui.core": "1.71.81",
|
|
20
|
+
"@openui5/sap.ui.fl": "1.71.81",
|
|
21
|
+
"@openui5/sap.ui.layout": "1.71.81",
|
|
22
|
+
"@openui5/themelib_sap_belize": "1.71.81"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<copyright>OpenUI5
|
|
7
7
|
* (c) Copyright 2009-2026 SAP SE or an SAP affiliate company.
|
|
8
8
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
|
|
9
|
-
<version>1.71.
|
|
9
|
+
<version>1.71.81</version>
|
|
10
10
|
|
|
11
11
|
<documentation>UI5 library: sap.ui.support</documentation>
|
|
12
12
|
|
|
@@ -32,7 +32,7 @@ sap.ui.define(["sap/ui/support/supportRules/Main",
|
|
|
32
32
|
* @deprecated Since version 1.60.0. Please use sap/ui/support/RuleAnalyzer instead.
|
|
33
33
|
* @alias jQuery.sap.support
|
|
34
34
|
* @author SAP SE
|
|
35
|
-
* @version 1.71.
|
|
35
|
+
* @version 1.71.81
|
|
36
36
|
* @public
|
|
37
37
|
*/
|
|
38
38
|
jQuery.sap.support = {
|
|
@@ -23,7 +23,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
23
23
|
* @namespace
|
|
24
24
|
* @name sap.ui.support
|
|
25
25
|
* @author SAP SE
|
|
26
|
-
* @version 1.71.
|
|
26
|
+
* @version 1.71.81
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
@@ -41,7 +41,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
41
41
|
controls: [],
|
|
42
42
|
elements: [],
|
|
43
43
|
noLibraryCSS: true,
|
|
44
|
-
version: "1.71.
|
|
44
|
+
version: "1.71.81",
|
|
45
45
|
extensions: {
|
|
46
46
|
//Configuration used for rule loading of Support Assistant
|
|
47
47
|
"sap.ui.support": {
|
|
@@ -53,7 +53,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
53
53
|
/**
|
|
54
54
|
* Defines severity types.
|
|
55
55
|
* @enum {string}
|
|
56
|
-
* @since 1.71.
|
|
56
|
+
* @since 1.71.81
|
|
57
57
|
* @public
|
|
58
58
|
*/
|
|
59
59
|
sap.ui.support.Severity = {
|
|
@@ -77,7 +77,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
77
77
|
/**
|
|
78
78
|
* Defines the Audiences.
|
|
79
79
|
* @enum {string}
|
|
80
|
-
* @since 1.71.
|
|
80
|
+
* @since 1.71.81
|
|
81
81
|
* @public
|
|
82
82
|
*/
|
|
83
83
|
sap.ui.support.Audiences = {
|
|
@@ -101,7 +101,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
101
101
|
/**
|
|
102
102
|
* Issue Categories.
|
|
103
103
|
* @enum {string}
|
|
104
|
-
* @since 1.71.
|
|
104
|
+
* @since 1.71.81
|
|
105
105
|
* @public
|
|
106
106
|
*/
|
|
107
107
|
sap.ui.support.Categories = {
|
|
@@ -170,7 +170,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
170
170
|
/**
|
|
171
171
|
* Analysis history formats.
|
|
172
172
|
* @enum {string}
|
|
173
|
-
* @since 1.71.
|
|
173
|
+
* @since 1.71.81
|
|
174
174
|
* @public
|
|
175
175
|
*/
|
|
176
176
|
sap.ui.support.HistoryFormats = {
|
|
@@ -189,7 +189,7 @@ sap.ui.define(["sap/ui/core/library"],
|
|
|
189
189
|
/**
|
|
190
190
|
* Contains the available system presets.
|
|
191
191
|
* @enum {object}
|
|
192
|
-
* @since 1.71.
|
|
192
|
+
* @since 1.71.81
|
|
193
193
|
* @public
|
|
194
194
|
*/
|
|
195
195
|
sap.ui.support.SystemPresets = {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2026 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/support/supportRules/WindowCommunicationBus",
|
|
9
|
+
"sap/ui/support/supportRules/WCBConfig"
|
|
10
|
+
],
|
|
11
|
+
function (CommunicationBusCommon, CommunicationBusConfig) {
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
var oCommunicationBus;
|
|
15
|
+
|
|
16
|
+
var CommunicationBus = CommunicationBusCommon.extend("sap.ui.support.supportRules.CommunicationBus", {
|
|
17
|
+
constructor: function () {
|
|
18
|
+
if (!oCommunicationBus) {
|
|
19
|
+
var oConfig = new CommunicationBusConfig({
|
|
20
|
+
modulePath: "sap/ui/support",
|
|
21
|
+
receivingWindow: "supportTool",
|
|
22
|
+
uriParams: {
|
|
23
|
+
origin: "sap-ui-xx-support-origin",
|
|
24
|
+
frameId: "sap-ui-xx-frame-identifier"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
CommunicationBusCommon.call(this, oConfig);
|
|
28
|
+
} else {
|
|
29
|
+
return oCommunicationBus;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
oCommunicationBus = new CommunicationBus();
|
|
35
|
+
|
|
36
|
+
return oCommunicationBus;
|
|
37
|
+
}, true);
|
|
@@ -15,7 +15,7 @@ sap.ui.define([
|
|
|
15
15
|
"sap/ui/support/supportRules/CoreFacade",
|
|
16
16
|
"sap/ui/support/supportRules/ExecutionScope",
|
|
17
17
|
"sap/ui/support/supportRules/ui/external/Highlighter",
|
|
18
|
-
"sap/ui/support/supportRules/
|
|
18
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
19
19
|
"sap/ui/support/supportRules/IssueManager",
|
|
20
20
|
"sap/ui/support/supportRules/History",
|
|
21
21
|
"sap/ui/support/supportRules/report/DataCollector",
|
|
@@ -125,34 +125,8 @@ function (jQuery, ManagedObject, Element, Component, Analyzer, CoreFacade,
|
|
|
125
125
|
|
|
126
126
|
IFrameController.injectFrame(aSupportModeConfig);
|
|
127
127
|
|
|
128
|
-
//
|
|
129
|
-
CommunicationBus.
|
|
130
|
-
try {
|
|
131
|
-
return new window.URL(msg.origin).origin === new window.URL(IFrameController.getFrameOrigin()).origin;
|
|
132
|
-
} catch (e) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
CommunicationBus.onMessageChecks.push(function (msg) {
|
|
138
|
-
return msg.data._frameIdentifier === IFrameController.getFrameIdentifier();
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
CommunicationBus.onMessageChecks.push(function (msg) {
|
|
142
|
-
try {
|
|
143
|
-
var oOriginUrl = new window.URL(msg.data._origin);
|
|
144
|
-
var sFramePath;
|
|
145
|
-
try {
|
|
146
|
-
sFramePath = new window.URL(IFrameController.getFrameUrl()).pathname;
|
|
147
|
-
} catch (e) {
|
|
148
|
-
// relative URL — strip query string and relative path segments manually
|
|
149
|
-
sFramePath = IFrameController.getFrameUrl().split("?")[0].replace(/\.\.\//g, "");
|
|
150
|
-
}
|
|
151
|
-
return oOriginUrl.pathname.endsWith(sFramePath);
|
|
152
|
-
} catch (e) {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
128
|
+
// mark the opened frame as a valid participant in the communication
|
|
129
|
+
CommunicationBus.allowFrame(IFrameController.getCommunicationInfo());
|
|
156
130
|
});
|
|
157
131
|
} else {
|
|
158
132
|
RuleSetLoader.updateRuleSets(function () {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
sap.ui.define([
|
|
13
13
|
"jquery.sap.global",
|
|
14
14
|
"sap/ui/support/supportRules/RuleSet",
|
|
15
|
-
"sap/ui/support/supportRules/
|
|
15
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
16
16
|
"sap/ui/support/supportRules/WCBChannels",
|
|
17
17
|
"sap/ui/support/supportRules/RuleSerializer",
|
|
18
18
|
"sap/ui/support/supportRules/Constants",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2026 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* global URLSearchParams */
|
|
8
|
+
sap.ui.define([
|
|
9
|
+
"sap/ui/thirdparty/URI"
|
|
10
|
+
],
|
|
11
|
+
function (URI) {
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
var DEFAULT_FRAME_ID = '_unnamed_frame_-_use_message_origin_';
|
|
15
|
+
|
|
16
|
+
var WCBConfig = function (oOptions) {
|
|
17
|
+
this._sModulePath = oOptions.modulePath;
|
|
18
|
+
this._sReceivingWindow = oOptions.receivingWindow;
|
|
19
|
+
|
|
20
|
+
if (oOptions.uriParams) {
|
|
21
|
+
this._sURIOrigin = oOptions.uriParams && oOptions.uriParams.origin;
|
|
22
|
+
this._sURIFrameId = oOptions.uriParams && oOptions.uriParams.frameId;
|
|
23
|
+
this._sOrigin = this.getOriginURIParameter(oOptions.uriParams.origin);
|
|
24
|
+
}
|
|
25
|
+
return this;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
WCBConfig.prototype.getOrigin = function () {
|
|
29
|
+
if (this._sOrigin) {
|
|
30
|
+
// when running in a tool frame, return the origin URI parameter
|
|
31
|
+
// when running in the opener window, return the already calculated origin
|
|
32
|
+
return this._sOrigin;
|
|
33
|
+
}
|
|
34
|
+
// When loading from CDN, module path needs to be relative to that origin
|
|
35
|
+
var modulePathURI = new URI(sap.ui.require.toUrl(this._sModulePath));
|
|
36
|
+
var protocol = modulePathURI.protocol() || window.location.protocol.replace(":", "");
|
|
37
|
+
var host = modulePathURI.host() || window.location.host;
|
|
38
|
+
|
|
39
|
+
this._sOrigin = protocol + "://" + host;
|
|
40
|
+
|
|
41
|
+
return this._sOrigin;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
WCBConfig.prototype.getFrameId = function () {
|
|
45
|
+
// the opener window assigns a tool frame an ID and includes in as a URI parameter upon opening the frame
|
|
46
|
+
// returns the frame's ID or a default value, when running in an opener window
|
|
47
|
+
return new URLSearchParams(window.location.search).get(this._sURIFrameId) || DEFAULT_FRAME_ID;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
WCBConfig.prototype.getOriginURIParameter = function () {
|
|
51
|
+
// the opener window sets its origin as a URI parameter upon opening the frame
|
|
52
|
+
return new URLSearchParams(window.location.search).get(this._sURIOrigin);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
WCBConfig.prototype.getReceivingWindow = function () {
|
|
56
|
+
// determine the current context (one side of communication) and return the opposite side of the communication
|
|
57
|
+
// determine the context by looking for a specific global property that would be present in an opener window and missing in a tool frame
|
|
58
|
+
if (window.communicationWindows && window.communicationWindows.hasOwnProperty(this._sReceivingWindow)) {
|
|
59
|
+
return window.communicationWindows[this._sReceivingWindow];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// If opener is not null, tool's UI is in an IFRAME (parent is used),
|
|
63
|
+
// else it's a POPUP WINDOW (opener is used)
|
|
64
|
+
return window.opener || window.parent;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return WCBConfig;
|
|
68
|
+
}, true);
|
|
@@ -8,76 +8,55 @@
|
|
|
8
8
|
* @typedef {object} EventListener
|
|
9
9
|
*/
|
|
10
10
|
sap.ui.define([
|
|
11
|
+
"sap/ui/base/Object",
|
|
11
12
|
"sap/base/Log",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
],
|
|
15
|
-
function (Log, jQuery, URI) {
|
|
13
|
+
"sap/base/util/isEmptyObject"
|
|
14
|
+
], function (BaseObject, Log, isEmptyObject) {
|
|
16
15
|
"use strict";
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* <h3>Overview</h3>
|
|
20
|
-
* The
|
|
19
|
+
* The WindowCommunicationBus is responsible for core communication between a tool frame and an application window
|
|
20
|
+
* Note that in each window there will be one "copy" of the class, so e.g. static properties will be instantiated again for each new window
|
|
21
|
+
* Since we need to configure the bus for multiple tools, for each tool we should create one inheriting class.
|
|
22
|
+
* Each of these child classes are singletons, so they will have one instance per window.
|
|
23
|
+
* If you need to share the exact same data between the two frames, use global variables
|
|
21
24
|
* @class
|
|
22
|
-
* @
|
|
23
|
-
* @name sap.ui.support.WindowCommunicationBus
|
|
24
|
-
* @memberof sap.ui.support
|
|
25
|
+
* @alias sap.ui.support.WindowCommunicationBus
|
|
25
26
|
* @author SAP SE
|
|
26
|
-
* @version 1.71.
|
|
27
|
+
* @version 1.71.81
|
|
27
28
|
* @private
|
|
28
29
|
*/
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
window.location.protocol.replace(":", "") : modulePathURI.protocol();
|
|
46
|
-
|
|
47
|
-
var host = modulePathURI.host() === "" ?
|
|
48
|
-
window.location.host : modulePathURI.host();
|
|
49
|
-
|
|
50
|
-
origin = protocol + "://" + host;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
CommunicationBus.origin = origin;
|
|
30
|
+
var WindowCommunicationBus = BaseObject.extend("sap.ui.support.supportRules.WindowCommunicationBus", {
|
|
31
|
+
constructor: function (oConfig) {
|
|
32
|
+
BaseObject.call(this);
|
|
33
|
+
this.bSilentMode = false;
|
|
34
|
+
this._channels = {};
|
|
35
|
+
this._frame = {};
|
|
36
|
+
this._oConfig = oConfig;
|
|
37
|
+
|
|
38
|
+
// inheriting classes will be singletons, and events should only be added once per window
|
|
39
|
+
if (window.addEventListener) {
|
|
40
|
+
window.addEventListener("message", this._onmessage.bind(this), false);
|
|
41
|
+
} else {
|
|
42
|
+
window.attachEvent("onmessage", this._onmessage.bind(this));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
54
46
|
|
|
55
47
|
/**
|
|
56
48
|
* Subscribes to a channel with callback and given context
|
|
57
|
-
* @private
|
|
58
|
-
* @static
|
|
59
|
-
* @method
|
|
60
|
-
* @name sap.ui.support.WindowCommunicationBus.subscribe
|
|
61
|
-
* @memberof sap.ui.support.WindowCommunicationBus
|
|
62
49
|
* @param {string} sChannelName Name of the channel to subscribe
|
|
63
50
|
* @param {function} fnCallback Callback for the SupportAssistant
|
|
64
51
|
* @param {object} oContext Context for the subscribed channel
|
|
65
52
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
WindowCommunicationBus.prototype.subscribe = function (sChannelName, fnCallback, oContext) {
|
|
68
54
|
if (this.bSilentMode) {
|
|
69
55
|
return;
|
|
70
56
|
}
|
|
71
57
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
callback: fnCallback,
|
|
75
|
-
context: oContext
|
|
76
|
-
}];
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
this.channels[sChannelName].push({
|
|
58
|
+
this._channels[sChannelName] = this._channels[sChannelName] || [];
|
|
59
|
+
this._channels[sChannelName].push({
|
|
81
60
|
callback: fnCallback,
|
|
82
61
|
context: oContext
|
|
83
62
|
});
|
|
@@ -85,109 +64,149 @@ function (Log, jQuery, URI) {
|
|
|
85
64
|
|
|
86
65
|
/**
|
|
87
66
|
* Publishes given channel by name and settings
|
|
88
|
-
* @private
|
|
89
|
-
* @static
|
|
90
|
-
* @method
|
|
91
|
-
* @name sap.ui.support.WindowCommunicationBus.publish
|
|
92
|
-
* @memberof sap.ui.support.WindowCommunicationBus
|
|
93
67
|
* @param {string} sChannelName Name of the channel to publish
|
|
94
68
|
* @param {string} aParams Settings passed to the SupportAssistant
|
|
95
69
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
70
|
+
WindowCommunicationBus.prototype.publish = function (sChannelName, aParams) {
|
|
98
71
|
if (this.bSilentMode) {
|
|
99
72
|
return;
|
|
100
73
|
}
|
|
101
74
|
|
|
102
|
-
var receivingWindow = this.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
75
|
+
var receivingWindow = this._oConfig.getReceivingWindow();
|
|
76
|
+
var dataObject = {
|
|
77
|
+
channelName: sChannelName,
|
|
78
|
+
params: aParams,
|
|
79
|
+
_frameIdentifier: this._getFrameIdentifier(),
|
|
80
|
+
_origin: window.location.href
|
|
81
|
+
};
|
|
109
82
|
|
|
110
83
|
// TODO: we need to find a way to make sure we're executing on the
|
|
111
84
|
// correct window. Issue happen in cases where we're too fast to
|
|
112
85
|
// post messages to the iframe but it is not there yet
|
|
113
|
-
receivingWindow.postMessage(dataObject, this.
|
|
86
|
+
receivingWindow.postMessage(dataObject, this._oConfig.getOrigin());
|
|
114
87
|
};
|
|
115
88
|
|
|
116
89
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @
|
|
119
|
-
* @static
|
|
120
|
-
* @method
|
|
121
|
-
* @name sap.ui.support.WindowCommunicationBus.destroyChannels
|
|
122
|
-
* @memberof sap.ui.support.WindowCommunicationBus
|
|
90
|
+
* mark an iframe as a valid participant in the communication
|
|
91
|
+
* @param {object} oOptions information about the iframe
|
|
123
92
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
93
|
+
WindowCommunicationBus.prototype.allowFrame = function (oOptions) {
|
|
94
|
+
// when a frame is opened from the application (opener) window, save the frame identifiers
|
|
95
|
+
// this will allow communication between the opener and the new frame
|
|
96
|
+
this._frame = {
|
|
97
|
+
origin: oOptions.origin,
|
|
98
|
+
identifier: oOptions.identifier,
|
|
99
|
+
url: oOptions.url
|
|
100
|
+
};
|
|
126
101
|
};
|
|
127
102
|
|
|
128
103
|
/**
|
|
129
|
-
*
|
|
104
|
+
* Clears all subscribed channels from the WindowCommunicationBus
|
|
130
105
|
* @private
|
|
131
|
-
* @static
|
|
132
|
-
* @method
|
|
133
|
-
* @name sap.ui.support.WindowCommunicationBus._getReceivingWindow
|
|
134
|
-
* @memberof sap.ui.support.WindowCommunicationBus
|
|
135
|
-
* @returns {object} Window containing the SupportAssistant
|
|
136
106
|
*/
|
|
137
|
-
|
|
107
|
+
WindowCommunicationBus.prototype.destroyChannels = function () {
|
|
108
|
+
this._channels = {};
|
|
109
|
+
};
|
|
138
110
|
|
|
139
|
-
|
|
140
|
-
|
|
111
|
+
/**
|
|
112
|
+
* This is the message handler used for communication between the WindowCommunicationBus and {@link sap.ui.support.WCBChannels}
|
|
113
|
+
* @private
|
|
114
|
+
* @param {EventListener} eMessage Event fired by the channels attached to the WindowCommunicationBus
|
|
115
|
+
*/
|
|
116
|
+
WindowCommunicationBus.prototype._onmessage = function (eMessage) {
|
|
117
|
+
if (!this._validate(eMessage)) {
|
|
118
|
+
Log.error("Message was received but failed validation");
|
|
119
|
+
return;
|
|
141
120
|
}
|
|
142
121
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
122
|
+
var callbackObjects = this._channels[eMessage.data.channelName] || [];
|
|
123
|
+
|
|
124
|
+
callbackObjects.forEach(function (cbObj) {
|
|
125
|
+
cbObj.callback.apply(cbObj.context, [eMessage.data.params]);
|
|
126
|
+
});
|
|
146
127
|
};
|
|
147
128
|
|
|
148
129
|
/**
|
|
149
|
-
*
|
|
130
|
+
* Compare the origins of two URLs. Returns false if either value is not a valid URL.
|
|
150
131
|
* @private
|
|
151
|
-
* @
|
|
152
|
-
* @
|
|
153
|
-
* @
|
|
154
|
-
* @memberof sap.ui.support.WindowCommunicationBus
|
|
155
|
-
* @param {EventListener} evt Event fired by the channels attached to the CommunicationBus
|
|
132
|
+
* @param {string} sOriginA First URL string
|
|
133
|
+
* @param {string} sOriginB Second URL string
|
|
134
|
+
* @returns {boolean} true if both URLs have the same origin
|
|
156
135
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
136
|
+
WindowCommunicationBus._compareOrigins = function (sOriginA, sOriginB) {
|
|
137
|
+
try {
|
|
138
|
+
return new window.URL(sOriginA).origin === new window.URL(sOriginB).origin;
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
162
143
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Validate messages received from external windows.
|
|
146
|
+
* Both directions are validated:
|
|
147
|
+
* - Tool frame: validates origin of messages from opener window
|
|
148
|
+
* - Application window: validates origin, frame identifier, and URL path of messages from tool frame
|
|
149
|
+
* @private
|
|
150
|
+
* @param {EventListener} eMessage Event fired by the channels attached to the WindowCommunicationBus
|
|
151
|
+
* @returns {boolean} true if the message is valid
|
|
152
|
+
*/
|
|
153
|
+
WindowCommunicationBus.prototype._validate = function (eMessage) {
|
|
154
|
+
// 1. Validate origin
|
|
155
|
+
// tool frame: validate against the configured opener origin
|
|
156
|
+
if (isEmptyObject(this._frame)) {
|
|
157
|
+
var sExpectedOrigin = this._oConfig.getOrigin();
|
|
158
|
+
|
|
159
|
+
if (sExpectedOrigin) {
|
|
160
|
+
return WindowCommunicationBus._compareOrigins(eMessage.origin, sExpectedOrigin);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return true;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
// application window: validate against the known tool frame origin
|
|
167
|
+
if (!WindowCommunicationBus._compareOrigins(eMessage.origin, this._frame.origin)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
171
170
|
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
// 2. Validate frame identifier
|
|
172
|
+
if (eMessage.data._frameIdentifier !== this._frame.identifier) {
|
|
173
|
+
return false;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
// 3. Validate URL path
|
|
177
|
+
// Compare parsed pathnames to avoid substring-matching attacks.
|
|
178
|
+
// The frame URL may be absolute or relative — strip query string and relative segments
|
|
179
|
+
// to extract the path portion, then verify the message origin's pathname ends with it.
|
|
180
|
+
try {
|
|
181
|
+
var oOriginUrl = new window.URL(eMessage.data._origin);
|
|
182
|
+
var iFrameUrlQuery = this._frame.url.indexOf("?");
|
|
183
|
+
var sFrameUrlWithoutQuery = this._frame.url.substring(0, iFrameUrlQuery).replace(/\.\.\//g, "").replace(/\.\//g, "");
|
|
184
|
+
|
|
185
|
+
// extract just the pathname: parse as URL if absolute, otherwise use the cleaned string as-is
|
|
186
|
+
var sFramePath;
|
|
187
|
+
try {
|
|
188
|
+
sFramePath = new window.URL(sFrameUrlWithoutQuery).pathname;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
// relative URL — use cleaned string directly as a path suffix
|
|
191
|
+
sFramePath = sFrameUrlWithoutQuery;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (!oOriginUrl.pathname.endsWith(sFramePath)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
} catch (e) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
180
200
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} else {
|
|
184
|
-
window.attachEvent("onmessage", CommunicationBus._onmessage);
|
|
185
|
-
}
|
|
201
|
+
return true;
|
|
202
|
+
};
|
|
186
203
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
WindowCommunicationBus.prototype._getFrameIdentifier = function () {
|
|
205
|
+
// a tool should start one frame whose ID is known by both the opener window and the frame.
|
|
206
|
+
// within the opener window, the ID of the opened frame is saved in the _frame property
|
|
207
|
+
// within the frame, the ID is 'saved' as a URI parameter.
|
|
208
|
+
return this._frame.identifier || this._oConfig.getFrameId();
|
|
209
|
+
};
|
|
191
210
|
|
|
192
|
-
return
|
|
211
|
+
return WindowCommunicationBus;
|
|
193
212
|
}, true);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"jquery.sap.global",
|
|
9
9
|
"sap/ui/base/ManagedObject",
|
|
10
|
-
"sap/ui/support/supportRules/
|
|
10
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
11
11
|
"sap/ui/support/supportRules/WCBChannels",
|
|
12
12
|
"sap/ui/support/supportRules/Constants"
|
|
13
13
|
],
|
|
@@ -175,16 +175,12 @@ function (jQuery, ManagedObject, CommunicationBus, channelNames, constants) {
|
|
|
175
175
|
this._oCore = null;
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
IFrameController.prototype.
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
IFrameController.prototype.getFrameUrl = function () {
|
|
187
|
-
return sFrameUrl;
|
|
178
|
+
IFrameController.prototype.getCommunicationInfo = function () {
|
|
179
|
+
return {
|
|
180
|
+
origin: sFrameOrigin,
|
|
181
|
+
identifier: sFrameIdentifier,
|
|
182
|
+
url: sFrameUrl
|
|
183
|
+
};
|
|
188
184
|
};
|
|
189
185
|
|
|
190
186
|
oIFrameController = new IFrameController();
|
|
@@ -18,7 +18,7 @@ sap.ui.define([
|
|
|
18
18
|
"sap/m/ToolbarSpacer",
|
|
19
19
|
"sap/m/Label",
|
|
20
20
|
"sap/m/MessageToast",
|
|
21
|
-
"sap/ui/support/supportRules/
|
|
21
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
22
22
|
"sap/ui/support/supportRules/WCBChannels",
|
|
23
23
|
"sap/ui/support/supportRules/ui/models/SharedModel",
|
|
24
24
|
"sap/ui/support/supportRules/RuleSerializer",
|
|
@@ -8,7 +8,7 @@ sap.ui.define([
|
|
|
8
8
|
"jquery.sap.global",
|
|
9
9
|
"sap/ui/support/supportRules/ui/controllers/BaseController",
|
|
10
10
|
"sap/ui/model/json/JSONModel",
|
|
11
|
-
"sap/ui/support/supportRules/
|
|
11
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
12
12
|
"sap/ui/support/supportRules/ui/models/SharedModel",
|
|
13
13
|
"sap/ui/support/supportRules/ui/external/ElementTree",
|
|
14
14
|
"sap/ui/support/supportRules/IssueManager",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/ui/support/supportRules/ui/controllers/BaseController",
|
|
9
9
|
"sap/ui/model/json/JSONModel",
|
|
10
|
-
"sap/ui/support/supportRules/
|
|
10
|
+
"sap/ui/support/supportRules/CommunicationBus",
|
|
11
11
|
"sap/ui/support/supportRules/ui/models/SharedModel",
|
|
12
12
|
"sap/ui/support/supportRules/WCBChannels",
|
|
13
13
|
"sap/ui/support/supportRules/Constants",
|