Edge couldn't access simple popup reference - reference

I try to get the reference of a popup to attach a listener. In Chrome and Firefox, I've no problems, only Microsoft edge make problems, put out access denied.
Following declaration return nothing or a null object. In chrome, I get an new window object.
pop = window.open('http://msn.com', 'mysite','');
Is that an edge model security problem? I've tried to change the trusted zone in Settings.
//complete simple code
pop = window.open('http://msn.com', 'mysite','');
pop.addEventListener('beforeunload', function(event){
event.preventDefault();
console.log('loading stuff');
event.returnValue='';
});
Permission denied SCRIPT70: Permission denied eval code (6) (2,1)
image of errormessage

Related

Chrome extension loses activeTab permission

I have an extension that, when the "browser action" (the icon next to the address bar) is clicked, executes a script on the current tab's page:
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript({
file: 'controls.js'
});
});
The controls.js injects some stuff into the DOM so that the user can press a key to tell background.js to set up a WebRTC connection and do other business-logic stuff.
Usually this works just fine. But sometimes the extension stops working on a tab if it has been open but not used for a while, I think typically after the computer has gone to sleep and woken again. When this happens, in the console for background.js, I get the error "Unchecked runtime.lastError: Cannot access contents of the page. Extension manifest must request permission to access the respective host."
Any idea why this could happen, or what I can do to catch this error and handle it to get permissions back?
It took me a lot of futzing around to figure this out.
If the user has been idle for a while, upon refreshing the page, the website I'm injecting JS into will redirect to an authentication site on another domain, which will then redirect the user back. It happens fast enough to not notice typically, but Chrome removes the activeTab permission when the domain changes.
I'm handling the permission loss by notifying the user through the badge text, more or less like this:
chrome.tabs.executeScript(tab.id, {
code: 'alert("hello activeTab")'
}, (result) => {
if (result === undefined) { // this means that activeTab permission is lost
console.log('lost activeTab permission :(');
chrome.browserAction.setBadgeText({
text: 'off',
tabId: tab.id
});
}
});

Chrome extension background script "Cannot access contens of URL devtools..." error?

I have a background script called events.js
I am occassionally getting this error
Unchecked runtime.lastError: Cannot access contents of url
"devtools://devtools/bundled/devtools_app.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/#ed9d447d30203dc5069e540f05079e493fc1c132/&dockSide=undocked".
Extension manifest must request permission to access this host.
It is apparently being generated not by events.js but by "_generated_background_page.html" but appearing in my background console log.
I suspect it is being caused by my call in events.js to:
chrome.webNavigation.onHistoryStateUpdated.addListener(function(e) {
// do stuff
}
It is driving me nuts. Can anyone please tell me what is going on?
Similar issue happened to me today. One of those facepalm moments. I discovered as i had a breakpoint in my background script to check something before the content-script was executed in the handle message, that this background devtools tab became the active tab and tired to inject the script and not the intended tab from which I activated my extension.
Hence the error.
Cannot access contents of url
"devtools://devtools/bundled/devtools_app.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/#7345a6d1bfcaff81162a957e9b7d52649fe2ac38/&dockSide=undocked".

Open navigation properties are not supported on OpenTypes. Property name: 'DirectoryDataService.changePassword'

Error shown When i try to update user password using Microsoft.Azure.ActiveDirectory.GraphClient
user.ChangePasswordAsync(currentPassword, newPassword);
It works correctly for me with following code.
await activeDirectoryClient.Users["userObjectId"].ChangePasswordAsync("oldPassword", "newPassword");
or
var user = activeDirectoryClient.Users.GetByObjectId("userObjectId")
await user.ChangePasswordAsync("oldPassword", "newPassword");
But I can this reproduce the error information with following code.
var user =(User)activeDirectoryClient.Users.GetByObjectId("userObjectId").ExecuteAsync().Result;
await user.ChangePasswordAsync("oldPassword", "newPassword");
I capture the request with fiddler then I find that 400 error. And the request url is
https://graph.windows.net/{tenantId}/directoryObjects/{userId}/changePassword?api-version=1.6
But the change password Graph API is
https://graph.windows.net/{tenantId}/users/<objectId>/changePassword or /users/userPrincipalName/changePassword
I assume that it is the reason why get that error information.
Note: Call the changePassword action for the signed-in user to change their own password.
We also could use the Microsoft graph SDK to do that. For more information, please refer to another SO thread.

instagram Invalid header: X-Insta-Forwarded-For is required for this operation

I have a problem when I try to give a picture admired by instagram api
Error message that appears to me
stdClass Object ( [code] => 403 [error_type] => OAuthForbiddenException [error_message] => Invalid header: X-Insta-Forwarded-For is required for this operation )
Code which is used to give the image impress
print_r($instagram->likeMedia(783976945516349891_353981601));
can you help me :(
I believe what you have to do is turn off the Enforce signed header option on your Instagram API developer account.
Go to http://instagram.com/developer/clients/manage/ (you may have to log in)
Click the Edit button to the right of your application name
Scroll down to the bottom of the page and unclick the 'Enforce signed header' checkbox
Click Update Client
That should get rid of your error.

Why am I getting a validation error?

On the node edit page, under file attachments, I'm getting the following error when I click attach:
Validation error, please try again. If this error persists, please contact the site administrator
More of an expedient work-around, perhaps: I disabled javascript long enough to perform my file upload and then turned it back on.
For the installation where I encountered this error a recursive grep on the modules paths showed this error message in the following paths:
modules/upload/upload.module
includes/form.inc
sites/all/modules/ctools/includes/form.inc
sites/all/modules/views/includes/form.inc
I encountered the error in the midst of a file upload, and a quick look at the upload.module showed the error came from a function called: upload_js(). So I disabled javascript in my browser and uploaded my file and then re-enabled javascript.
Before doing that I ensured that my user had privileges and an ample quota for uploading this < 400kb file, bumped the max_file_uploads setting and restarted php5-fpm/apache.
The complaining code looks like this:
// Load the form from the Form API cache.
if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form['#node']) || !isset($cached_form['attachments'])) {
form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
$output = theme('status_messages');
print drupal_to_js(array('status' => TRUE, 'data' => $output));
exit();
}

Resources