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

feat: update checkApp origin requirement #126

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/data/messages/proctorio.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* vendor-specific integrations long term. As of now these events
* will trigger on ANY lti integration, not just Proctorio.
*/
import { getConfig } from '@edx/frontend-platform';

export async function checkAppStatus() {
return new Promise((resolve, reject) => {
const handleResponse = event => {
if (event.origin === window.location.origin) {
if (event.origin === getConfig().EXAMS_BASE_URL) {
window.removeEventListener('message', handleResponse);
if (event?.data?.active) {
resolve();
Expand Down
4 changes: 2 additions & 2 deletions src/data/redux.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ describe('Data layer integration tests', () => {
await new Promise(process.nextTick);
const handleResponseCb = mockAddEventListener.mock.calls[0][1];
axiosMock.onPut(`${createUpdateAttemptURL}/${proctoredAttempt.attempt_id}`).reply(200, { exam_attempt_id: proctoredAttempt.attempt_id });
handleResponseCb({ origin: 'https://edx.example.com', data: { active: false } });
handleResponseCb({ origin: 'http://localhost:18740', data: { active: false } });

await new Promise(process.nextTick);
const request = axiosMock.history.put[0];
Expand All @@ -1171,7 +1171,7 @@ describe('Data layer integration tests', () => {

await new Promise(process.nextTick);
const handleResponseCb = mockAddEventListener.mock.calls[0][1];
handleResponseCb({ origin: 'https://edx.example.com', data: { active: true } });
handleResponseCb({ origin: 'http://localhost:18740', data: { active: true } });

await new Promise(process.nextTick);
expect(axiosMock.history.put.length).toBe(0);
Expand Down
Loading