Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-113532 Modernize Liferay.Util.getTop() #2056

Closed
wants to merge 1 commit into from

Conversation

kresimir-coko
Copy link
Collaborator

LPS in question: https://issues.liferay.com/browse/LPS-113532

This one was a bit of a hassle due to testing woes around the Window object. The implementation itself is kinda whatever, nothing fancy.

This util usually gets invoked in modals/popups to retrieve the proper Window object needed for further work in the app.

@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:relevant
  •     ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 5 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 3d6eb0214c3320742b21034bda6935f37c6dc4da

Sender Branch:

Branch Name: getTop
Branch GIT ID: 65b4d2feae156acfc0ece785609df2b7c24effbb

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

@liferay-continuous-integration
Copy link
Collaborator

❌ ci:test:stable - 26 out of 28 jobs passed

❌ ci:test:relevant - 26 out of 29 jobs passed in 2 hours 12 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 3d6eb0214c3320742b21034bda6935f37c6dc4da

Upstream Comparison:

Branch GIT ID: 3d6eb0214c3320742b21034bda6935f37c6dc4da
Jenkins Build URL: Acceptance Upstream DXP (master) #3063

ci:test:stable - 26 out of 28 jobs PASSED
26 Successful Jobs:
ci:test:relevant - 26 out of 29 jobs PASSED
26 Successful Jobs:
For more details click here.

Failures unique to this pull:

  1. test-portal-acceptance-pullrequest-batch(master)/semantic-versioning-jdk8/0
    Job Results:

    0 Tests Passed.
    1 Test Failed.

    1. AXIS_VARIABLE=0 #340925

      Please fix semantic versioning on kresimir-coko/getTop

           [exec]   PACKAGE_NAME                                       DELTA      CUR_VER    BASE_VER   REC_VER    WARNINGS  
           [exec] = ================================================== ========== ========== ========== ========== ==========
           [exec] * com.liferay.portal.kernel.portlet                  MAJOR      14.0.0     14.0.0     15.0.0     VERSION INCREASE REQUIRED
           [exec]   >   class      com.liferay.portal.kernel.portlet.BasePortletLayoutFinder
           [exec]     -   method     fetchPlidAndPortletId(com.liferay.portal.kernel.security.permission.PermissionChecker,long,java.lang.String[])
           [exec]       -   access     protected
           [exec]       -   return     java.lang.Object[]
           [exec]   >   class      com.liferay.portal.kernel.portlet.BasePortletLayoutFinder$ResultImpl
           [exec]     -   method     <init>(com.liferay.portal.kernel.portlet.BasePortletLayoutFinder,long,java.lang.String)
           [exec]       -   return     void
           [exec]   >   class      com.liferay.portal.kernel.portlet.UserAttributes
           [exec]     -   field      USER_NAME_NICKNAME
           [exec]       -   access     final
           [exec]       -   access     static
           [exec]       -   constant   user.name.nickName
           [exec]       -   return     java.lang.String
           [exec] [Baseline Warning] Bundle Version Change Recommended: 43.0.0
           [exec] [Baseline Report] Mode: diff (persisted)
           [exec] Semantic versioning is incorrect while checking /opt/dev/projects/github/liferay-portal/portal-kernel/portal-kernel.jar against /opt/dev/projects/github/liferay-portal/.gradle/caches/modules-2/files-2.1/com.liferay.portal/com.liferay.portal.kernel/42.0.0/7088f2dcc47cbb91710fbaa51a1869dd93a83044/com.liferay.portal.kernel-42.0.0.jar


Failures in common with acceptance upstream results at 3d6eb02:
  1. test-portal-acceptance-pullrequest-batch(master)/lpkg-base-jdk8/0
    Job Results:

    0 Tests Passed.
    1 Test Failed.

    1. AXIS_VARIABLE=0 #457045

      Please fix semantic versioning on kresimir-coko/getTop

           [exec]   PACKAGE_NAME                                       DELTA      CUR_VER    BASE_VER   REC_VER    WARNINGS  
           [exec] = ================================================== ========== ========== ========== ========== ==========
           [exec] * com.liferay.portal.kernel.portlet                  MAJOR      14.0.0     14.0.0     15.0.0     VERSION INCREASE REQUIRED
           [exec]   >   class      com.liferay.portal.kernel.portlet.BasePortletLayoutFinder
           [exec]     -   method     fetchPlidAndPortletId(com.liferay.portal.kernel.security.permission.PermissionChecker,long,java.lang.String[])
           [exec]       -   access     protected
           [exec]       -   return     java.lang.Object[]
           [exec]   >   class      com.liferay.portal.kernel.portlet.BasePortletLayoutFinder$ResultImpl
           [exec]     -   method     <init>(com.liferay.portal.kernel.portlet.BasePortletLayoutFinder,long,java.lang.String)
           [exec]       -   return     void
           [exec]   >   class      com.liferay.portal.kernel.portlet.UserAttributes
           [exec]     -   field      USER_NAME_NICKNAME
           [exec]       -   access     final
           [exec]       -   access     static
           [exec]       -   constant   user.name.nickName
           [exec]       -   return     java.lang.String
           [exec] [Baseline Warning] Bundle Version Change Recommended: 43.0.0
           [exec] [Baseline Report] Mode: diff (persisted)
           [exec] Semantic versioning is incorrect while checking /opt/dev/projects/github/liferay-portal/portal-kernel/portal-kernel.jar against /opt/dev/projects/github/liferay-portal/.gradle/caches/modules-2/files-2.1/com.liferay.portal/com.liferay.portal.kernel/42.0.0/7088f2dcc47cbb91710fbaa51a1869dd93a83044/com.liferay.portal.kernel-42.0.0.jar

Test bundle downloads:

@liferay-continuous-integration
Copy link
Collaborator

@kresimir-coko
Copy link
Collaborator Author

ci:test:relevant

Copy link
Collaborator

@bryceosterhaus bryceosterhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the correct move of where this code should live, moving it out from aui-web and into js-web. However, I noticed the logic of the function changed a bit and I don't think it is the same as it was before.

I would just copy the original code, and update the references to Util._topWindow and reference a local variable of topWindow in the file.

let _topWindow;

function getTop() {
	// ...
		_topWindow = topWindow;
	}

	return topWindow;
}

return window;
}

while (parentWindow) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code had

while (parentWindow !== window) {

I think this change might actually create some bugs as it is not the same logical flow. I know you add the check above this block, but I think we actually need that in the while loop as the parentWindow is being set to a different value on each iteration.

*/

export default function getTop() {
const SIMULATION_DEVICE_IFRAME = 'simulationDeviceIframe';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be hoisted outside of the function as it is a constant

@kresimir-coko
Copy link
Collaborator Author

ci:stop

@liferay-continuous-integration
Copy link
Collaborator

❌ ci:test:relevant - 0 out of 1 jobs passed in 32 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 9b640c3cfb997f3512a83ae79c1e24b44224f27e

Upstream Comparison:

Branch GIT ID: 9b640c3cfb997f3512a83ae79c1e24b44224f27e
Jenkins Build URL: Acceptance Upstream DXP (master) #3066

ci:test:relevant - 0 out of 1 jobs PASSED
For more details click here.
Test bundle downloads:

@liferay-continuous-integration
Copy link
Collaborator

@liferay-continuous-integration
Copy link
Collaborator

Unexpected errors occurred while attempting to forward pull request to 'brianchandotcom', please try again later or contact a CI Infrastructure member for assistance.
Console

1 similar comment
@liferay-continuous-integration
Copy link
Collaborator

Unexpected errors occurred while attempting to forward pull request to 'brianchandotcom', please try again later or contact a CI Infrastructure member for assistance.
Console

@liferay-continuous-integration
Copy link
Collaborator

Error has occurred while forwarding pull request to brianchandotcom
See console log for details: Full Console

@kresimir-coko
Copy link
Collaborator Author

ci:forward

@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:relevant
  •     ci:test:sf

The pull request will automatically be forwarded to the user brianchandotcom if the following test suites pass:

  •     ci:test:relevant
  •     ci:test:sf
  •     ci:test:stable

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 5 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 87970afda7806bb1ae546cf0c1b7c8f4af65a60d

Sender Branch:

Branch Name: getTop
Branch GIT ID: f93b1be619dfbadbaf34b0358a366b6bcc72acf0

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 26 out of 27 jobs passed

✔️ ci:test:relevant - 27 out of 28 jobs passed in 1 hour 50 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 87970afda7806bb1ae546cf0c1b7c8f4af65a60d

Upstream Comparison:

Branch GIT ID: 87970afda7806bb1ae546cf0c1b7c8f4af65a60d
Jenkins Build URL: Acceptance Upstream DXP (master) #3079

ci:test:stable - 26 out of 27 jobs PASSED
26 Successful Jobs:
ci:test:relevant - 26 out of 28 jobs PASSED
26 Successful Jobs:
For more details click here.

This pull contains no unique failures.


Failures in common with acceptance upstream results at 87970af:
  1. test-portal-acceptance-pullrequest-batch(master)/functional-smoke-wildfly180-mariadb104-jdk8/0
    Job Results:

    0 Tests Passed.
    1 Test Failed.

    1. AXIS_VARIABLE=0 #26023
          [junit]   at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
          [junit]   at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
          [junit]   at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
          [junit]   at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:427)
          [junit]   at java.nio.file.Files.newDirectoryStream(Files.java:525)
          [junit]   at com.liferay.portal.log.assertor.PortalLogAssertorTest.testScanOSGiLog(PortalLogAssertorTest.java:62)
          [junit] 
          [junit] 
          [junit] Test com.liferay.portal.log.assertor.PortalLogAssertorTest FAILED
      [stopwatch] [test.cmd: 0.511 sec]
      [stopwatch] [run.batch.test.action: 31:11.629 sec]
           [echo] The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test-batch.xml:365: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test-batch.xml:1656: /opt/dev/projects/github/liferay-portal/build-test-batch.xml:1660: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test-wildfly.xml:26: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test-wildfly.xml:36: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test.xml:13919: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test.xml:14284: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test.xml:4737: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test.xml:4820: The following error occurred while executing this line:
           [echo] /opt/dev/projects/github/liferay-portal/build-test.xml:5833: No server is available at http://localhost:8080/web/guest
            [get] Getting: ${dependencies.url}/archive/test-1-35/test-portal-acceptance-pullrequest-batch(master)/AXIS_VARIABLE=0/26023consoleText
            [get] To: /opt/dev/projects/github/liferay-portal/20220331032053204.txt
         [delete] Deleting: /opt/dev/projects/github/liferay-portal/20220331032053204.txt
         [delete] Deleting: /opt/dev/projects/github/liferay-portal/null1560820569.properties
Test bundle downloads:

@liferay-continuous-integration
Copy link
Collaborator

All required test suite(s) passed.
Forwarding pull request to brianchandotcom.
Console

@liferay-continuous-integration
Copy link
Collaborator

Pull request has been successfully forwarded to brianchandotcom#115501
Console

@liferay-continuous-integration
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants